{{ result.summary.heading }}
{{ result.summary.primary }}
{{ result.summary.line }}
{{ badge.label }}
Dockerfile generator inputs
Name the service, repository, or image target this Dockerfile will build.
Pick the runtime family so the generator can shape stages, cache mounts, users, and healthcheck style.
Keep this explicit, such as 22, 3.12, 1.24, or 21.
Choose the base-image variant that best matches your package and runtime compatibility needs.
Use an absolute path inside the image.
Use the dependency install step that should be cached separately from source changes.
Optional command for TypeScript, asset, binary, jar, or other build artifacts.
Final command for the runtime container.
The generated Dockerfile uses this for EXPOSE and supported HTTP healthchecks.
tcp
Use a lightweight local HTTP path, such as /health, when the runtime template supports it.
Comma or newline separated names; blank keeps the generated runtime lean.
One NAME=value or NAME per line.
One KEY=value per line; blank keeps only stack defaults.
One key=value label per line.
Leave off for a terse production Dockerfile.
{{ params.include_comments ? 'On' : 'Off' }}
{{ codeFor(tab.key) }}
{{ header }} Copy
{{ cell }}
No rows for the current Dockerfile inputs.

        
Customize
Advanced
:

Introduction:

A Dockerfile turns application source, dependency manifests, build commands, runtime settings, and a base image into a repeatable container image recipe. Small choices in that recipe change rebuild speed, image size, cache reuse, secret exposure, and the privileges available to the process that finally runs in production.

Container image drafts are most useful before a service has a settled build pipeline. A Node.js API, Python service, Go binary, or Maven-built Java app often needs the same first decisions: which runtime version to pin, which files should be copied before source code, which command should start the container, and whether the final image should expose a port or publish a health probe.

The important boundary is that a generated Dockerfile is still a draft. It cannot prove that the image builds, that the base tag is patched, that a health endpoint answers correctly, or that copied files match the repository layout. It gives a structured starting point and review checklist, then the real confidence comes from an actual build, image scan, and runtime smoke test.

Container image draft flow from stack inputs to Dockerfile, ignore rules, and review ledgers

The best early output is not the shortest file. It is a Dockerfile that makes its base image, dependency cache, runtime copy, non-root user, health behavior, and build-context exclusions easy to inspect before the image enters CI.

Technical Details:

A Dockerfile build is an ordered set of instructions. The first FROM instruction chooses a base image, and later FROM instructions create additional stages. Multi-stage builds let dependency tools, compilers, and package caches stay in builder stages while only the needed runtime artifacts move into the final image.

BuildKit cache mounts are temporary build-time caches. They are useful for package managers because dependency downloads can be reused without writing those caches into the final image. A separate build context filter removes files before the context reaches the builder, so ignored local caches, logs, keys, and environment files are not available to COPY instructions.

Transformation Core

The generator maps stack choices to base images, dependency files, cache mounts, runtime users, and healthcheck support. The generated text always starts with the Dockerfile frontend directive needed for cache-mount syntax.

Dockerfile generator stack mapping
Stack Base-image pattern Dependency cache Runtime shape
Node.js service node:version-flavor npm, pnpm, or yarn cache based on install and build commands Deps, build, and runtime stages with USER node and optional HTTP probe
Python service python:version-flavor pip cache and a copied virtual environment Builder and runtime stages with an app user and optional HTTP probe
Go service golang:version-flavor to distroless nonroot runtime Go module and build caches Compiled /out/app copied to a minimal nonroot final image
Java Maven service maven:3.9-eclipse-temurin-version to Eclipse Temurin JRE Maven local repository cache Packaged jar copied to a JRE runtime image with an app user

Command handling favors JSON exec form. A simple command such as node server.js becomes a JSON array. A command that starts as a valid JSON array is preserved. Shell operators such as pipes, redirects, semicolons, command substitution, or chained commands are kept under sh -c, and the warning list calls that out because signal handling and process shutdown can differ.

Generated review signals and meaning
Signal How it is produced Review meaning
Pinned base tag Runtime version and image flavor are combined into stack-specific base tags. Using latest or a flavor containing latest raises a reproducibility warning.
Package cache mount Recognized package managers add RUN --mount=type=cache for install or build commands. Missing cache mounts can mean repeat dependency installs rebuild more often.
Non-root runtime Node uses USER node, Python and Java create app, and Go uses distroless nonroot. The final process is not intended to run as root unless the draft is later changed by hand.
Healthcheck Node and Python can emit local HTTP probes when a health path and positive port are set. Go and Java record the endpoint intent but do not emit a probe because their runtime images lack a safe built-in HTTP probe command.
Context hygiene The ignore-rule output combines common VCS, log, secret, cache, and stack-specific exclusions. Review exceptions before copying the rules into repositories with unusual generated files or checked-in artifacts.
Secret-like keys Build argument and environment keys are scanned for words such as token, password, private, credential, or API key. Use Docker build secrets or runtime secret injection instead of baking sensitive values into image history or metadata.

Validation is intentionally narrow. The page blocks missing install commands for stacks that need them, missing start commands, and ports outside 0 through 65535. A port of 0 intentionally omits EXPOSE and health URL wiring. The page does not run a build, query a registry, inspect dependency files, or confirm that generated paths exist in the repository.

Everyday Use & Decision Guide:

Start with Image label and Application stack. The label feeds the generated OCI title label and exported snapshots, while the stack changes the base-image defaults, install command, build command, start command, port, and health path.

Keep Runtime version explicit. A version such as 22, 3.12, 1.24, or 21 gives reviewers something concrete to pin, scan, and update. A latest-style value still produces output, but the warning list should slow the handoff because rebuilds can change without a Dockerfile edit.

  • Use Debian bookworm slim or similar defaults when package compatibility matters more than a smaller Alpine-style base.
  • Set Work directory to the path where dependency install, source copy, and the final command should run.
  • Put dependency installation in Install command so the generated draft can cache it separately from source changes.
  • Leave Build command blank for services that do not compile assets, binaries, jars, or bundles.
  • Set App port to 0 only when the image should omit EXPOSE and generated health URL wiring.

Use Advanced for release-review details, not for every draft. Extra OS packages increase the runtime surface and trigger a warning. Build arguments and additional environment rows should avoid secret-like names. Additional labels are useful when CI can supply source, version, or revision metadata, but the generated default already includes an OCI title label.

The main misread is treating Dockerfile draft ready as a deployment approval. It only means the entered values passed this page's checks. Read Build Plan to see the stage sequence, then read Hardening Ledger for cache, healthcheck, non-root, label, and context-hygiene cues before running the real build.

Step-by-Step Guide:

Work through the inputs once, then review the generated text and ledgers before copying the draft into a repository.

  1. Enter Image label, such as orders-api, and choose Application stack. The summary should update to a stack label such as Node.js service with the current stage count.
  2. Confirm Runtime version and Image flavor. If a latest-style value is used, expect a generation note about reproducible builds.
  3. Review Work directory, Install command, Build command, and Start command. If Review Dockerfile inputs appears, restore the missing install or start command before using the output.
  4. Set App port and Health endpoint. A positive port can emit EXPOSE; Node and Python can also emit generated HTTP healthchecks when a path is present.
  5. Open Advanced only when the draft needs extra OS packages, build arguments, environment rows, labels, or instruction comments. Clear any secret-like ARG or ENV warning before sharing the file.
  6. Open Dockerfile and check the base tags, COPY steps, USER, EXPOSE, HEALTHCHECK, and final CMD.
  7. Open .dockerignore and compare the generated exclusions with the repository. Keep cache, log, secret, and VCS exclusions, then review any exception the project requires.
  8. Use Build Plan for a compact explanation of the generated stages, dependency cache, runtime copy, command form, ignore-rule count, and instruction count.
  9. Use Hardening Ledger and JSON after the text looks right. They summarize the same draft for review notes, CI handoff, or a pull-request comment.

Interpreting Results:

Dockerfile draft ready means the inputs are sufficient to generate code. The summary also reports the selected stack, stage count, instruction count, ignore-rule count, healthcheck status, cache-mount status, and exposed port status.

Dockerfile draft blocked means the output is intentionally blank until the listed input error is fixed. The most likely causes are a cleared install command for Node, Python, or Java, a missing start command, or an app port outside 0 through 65535.

Dockerfile generator result cues
Output cue Meaning Follow-up check
cache mounts At least one supported package-manager cache mount appears in a generated RUN instruction. Build once, then rebuild after a source-only edit to confirm dependency steps are reused as expected.
no healthcheck No generated HEALTHCHECK is present, either because the health path is blank or the stack uses a minimal runtime path. Add a lightweight probe later if the deployment platform reads image healthchecks.
no expose App port is 0, so EXPOSE is omitted. Confirm that the runtime platform already knows the listener port or that the image is not a network service.
Secret-like ARG or ENV keys A build argument or environment key looks sensitive by name. Move the sensitive value to Docker build secrets, runtime secrets, or the deployment platform's secret store.

Do not overread the hardening ledger. It checks generated structure, not image contents. A strong result still needs a successful docker build, dependency vulnerability scan, container start test, endpoint check when relevant, and any team-required signing or provenance step.

Worked Examples:

Node.js API with a build step

A service named orders-api uses Node.js service, runtime version 22, Debian bookworm slim, Install command npm ci, Build command npm run build, Start command node server.js, port 3000, and health path /health. The summary should report Node.js service, three stages, cache mounts, healthcheck, and EXPOSE 3000. The Build Plan should show dependency files copied before source and an exec-form CMD.

Go service with a minimal runtime

A Go API uses version 1.24, Install command go mod download, the default static Linux build command, Start command /app/app, and port 8080. The draft should use a Go builder image and a distroless nonroot runtime image, then copy /out/app into /app/app. If a health path is entered, Generation notes should say the endpoint is recorded but no safe built-in HTTP probe is emitted for that stack.

Python service with a cleared install step

A Flask or FastAPI service with runtime 3.12, port 8000, and start command gunicorn app:app --bind 0.0.0.0:8000 still needs an install command such as pip install --no-cache-dir -r requirements.txt. If Install command is cleared, Review Dockerfile inputs should ask for an install command, and Dockerfile draft blocked should remain until the dependency step is restored.

Secret-like value in advanced settings

If Build args contains API_TOKEN=abc123 or Additional env contains PASSWORD=example, the draft can still be generated, but Generation notes should warn about secret-like keys. The safer fix is to remove those rows from the Dockerfile draft and pass the value through a build secret, runtime secret, or deployment environment outside the image.

FAQ:

Does the generator build or test the image?

No. It creates Dockerfile text, ignore rules, review tables, and a JSON snapshot from the entered values. Run the generated draft through a real build, scan, and smoke test before release use.

Why is a healthcheck missing?

A blank Health endpoint omits the healthcheck. Node and Python can emit lightweight local HTTP probes when a path and positive port are present, while Go and Java avoid emitting a probe for their minimal runtime shape.

Can I put secrets in build args or environment rows?

Avoid that. The warning list flags secret-like keys because Dockerfile ARG and ENV values can persist in image metadata or history. Use build secrets or runtime secret injection instead.

Why does the start command sometimes use sh -c?

Simple commands become JSON exec-form arrays. If the command contains shell operators such as pipes, redirects, semicolons, or command substitution, the generator preserves the shell behavior with sh -c and adds a warning.

What should I check before copying the ignore rules?

Check that generated exclusions such as VCS data, logs, local environment files, keys, package caches, and build outputs match the repository. Keep required source and generated assets available to the build context.

Glossary:

Multi-stage build
A Dockerfile pattern that uses multiple FROM instructions so build tools can stay outside the final runtime image.
BuildKit cache mount
A temporary cache attached to a RUN instruction for package-manager downloads and build caches.
Build context
The files sent to the Docker builder and made available to COPY or ADD instructions.
Runtime stage
The final image stage that contains the files, user, port, healthcheck, and command used when the container starts.
Exec-form command
A JSON-array CMD form that starts the process directly instead of wrapping it in a shell.
OCI label
Image metadata using Open Container Initiative-style keys, such as the generated title label.

References: