How to use
- Pick a language or framework. Presets cover Node.js, Next.js, Python, Go, Java, Rust, .NET and static sites (nginx).
- Choose the base image version and app port, then fill in the fields that preset needs (package manager, start command, JAR path and so on).
- Turn best practices on or off with the multi-stage build, non-root user and HEALTHCHECK checkboxes.
- Copy or download the generated
Dockerfileand.dockerignore. Build and run commands are shown too.
Options
| Option | What it does |
|---|---|
| Multi-stage build | Keeps build tools and source out of the final image, which makes it smaller and shrinks the attack surface. Next.js and static sites are always multi-stage. |
| Non-root user | Runs the container process as a user other than root. Node uses the built-in node user, others create an app user with UID 10001, and .NET uses USER $APP_UID. |
| HEALTHCHECK | Calls the app port and path every 30 seconds and marks the container healthy or not. It only uses tools the image has (wget, python). |
| .dockerignore | Keeps files such as .git, .env and node_modules out of the build context and the image. .env.example is kept as an exception. |
What each preset produces
- Node.js:
node:<version>-alpine. With the build step on, it is split into install, build and a runtime stage that installs production dependencies only. Installs use the lock file:npm ci,pnpm install --frozen-lockfileoryarn install --frozen-lockfile. - Next.js: copies only the
output: "standalone"result (.next/standalone,.next/static,public) and runsnode server.js. Yournext.configmust enable standalone output. - Python: installs packages into a virtual environment at
/opt/venvin the first stage and copies just that folder to the runtime stage. Flask and Django default to gunicorn, FastAPI to uvicorn; make sure the package is inrequirements.txt. - Go: builds a static binary with
CGO_ENABLED=0and copies it toalpine. It copiesgo.sum*so the build still works when there is nogo.sum. - Java: Maven copies
pom.xmlfirst so the dependency layer is cached, and the runtime image iseclipse-temurin:<version>-jre-alpine. Gradle runsbootJar, so check the JAR path yourself. - Rust: builds on
rust:1-bookwormand runs ondebian:bookworm-slim, the same Debian generation, because a glibc mismatch between builder and runtime breaks the binary. - Static site: puts your build output on nginx. With non-root on it uses
nginxinc/nginx-unprivilegedand port 8080; with it off,nginx:stable-alpineand port 80.
Example: multi-stage Node.js
With the build step on and the start command node dist/index.js, you get three stages: deps, build and runtime. The runtime stage installs production dependencies with npm ci --omit=dev, copies only the dist folder and switches to USER node.
Things to watch
- Image tag versions are only the choices offered when this page was written. Check the support window of your language version and the real tags on Docker Hub, and pin a digest if you need reproducible builds.
- Review the generated Dockerfile before putting it into production. Your app may need extra system packages, build arguments or a migration step.
- Do not put passwords, API keys or tokens into the image with
ENVorARG; they stay in the image history. Pass them at run time as environment variables, secrets or volumes. - To run several services together, continue with the Docker Compose Generator, and for a reverse proxy in front use the Nginx Config Generator. Environment files can be tidied with the Env Converter, a host service can be written with the systemd Service Generator, and YAML can be checked with the JSON YAML Converter.
Frequently asked questions
Why use a multi-stage build?
Compilers, dev dependencies and source code are only needed to build. Copying just the result into the final image makes it smaller and leaves fewer tools for an attacker to use.
What changes when I run as a non-root user?
If the app is compromised inside the container, the attacker does not get root, so the damage is limited. Some environments such as Kubernetes do not let non-root processes bind ports below 1024, so a high port such as 3000 or 8080 is recommended.
Alpine or slim images?
This tool uses alpine for Node, Go and Java and slim (Debian) for Python, because some Python packages have no prebuilt wheels for alpine (musl) and can be slow or fail to install there.
What if my HEALTHCHECK keeps reporting unhealthy?
Check that the app answers with a non-error status on the path you set, and that it binds to 0.0.0.0 so 127.0.0.1 inside the container works. If the runtime image has no wget or curl, you have to install one.
Is my input sent to a server?
No. The Dockerfile is generated in your browser and goes nowhere.
Your input is processed in this browser and never sent to a server.