Dockerfile Generator and Linter

Small images, non-root, explained.

Pick a stack and get a multi-stage Dockerfile with a pinned base image, a non-root user, a working healthcheck, and a matching .dockerignore, with every line explained. Paste any Dockerfile to lint it with line numbers.

Zero retention: your data never leaves this browser. Verify it yourself in DevTools

Loading the toolbox.

About Dockerfile

How Can You Verify That Nothing Leaves This Browser?

You do not have to take our word that your data stays here. Developer tools show every request a page makes, so you can watch this page work and confirm that nothing is sent. The check takes under a minute.

  1. Open your browser developer tools with F12, or Cmd+Option+I on a Mac, and select the Network tab.
  2. Reload the page and let it finish. You will see the page's own files, its web fonts, and one anonymous page-view request. Nothing has been typed yet, so none of them can contain your data.
  3. Click the clear icon in the Network tab so that the log is empty.
  4. Use the tool with your own input.
  5. Look at the Network tab again. It is still empty. For extra proof, turn on offline mode after the page loads and the tool keeps working.

Only two things can add a line to that log, and neither carries your data. Submitting the feedback form sends the vote and comment you typed. Typing characters in a script the page has not displayed yet, such as Cyrillic or Greek, can make the browser fetch the matching font file, and that request names only the font.

The production site also sends a Content-Security-Policy header that tells your browser to refuse connections to anywhere except this site and the anonymous analytics endpoint, so a coding mistake could not quietly send your data elsewhere.

What Does the Dockerfile Generator Make?

It writes a production-shaped Dockerfile for four common stacks, plus the .dockerignore that goes with it and the two commands to build and run the image. Each file follows the same pattern: a build stage that has the compilers and dev dependencies, and a small runtime stage that receives only what the app needs to run.

  • Node: a dependencies stage with production packages only, an optional build stage for TypeScript or a bundler, and a runtime stage on the slim Node image that runs as the built-in node user. npm, pnpm, and Yarn are supported, each with its lockfile-respecting install command.
  • Python: dependencies installed into a virtual environment in the build stage, copied into the runtime stage, and served by uvicorn or gunicorn as a dedicated system user.
  • Static site: Node builds the site, then the output is copied into an unprivileged nginx image that listens on port 8080.
  • Go: a static binary built with CGO_ENABLED=0, copied into a distroless image that has no shell and runs as a non-root user.

Why Use a Multi-Stage Build?

A single-stage image carries everything that was needed to build the app: compilers, dev dependencies, package caches, and sometimes source files you never meant to ship. All of it adds size, start-up time, and attack surface. A multi-stage build uses one image to build and a second, clean image to run, and copies only the finished output across with COPY --from.

The order of steps matters as much as the stages. Each generated file copies the dependency manifest and lockfile first, installs, and only then copies the rest of the source. Docker reuses a cached layer until one of its inputs changes, so a code change re-runs only the steps after the source copy, and the slow dependency install comes straight from cache.

Why Run the Container as a Non-Root User?

By default a container process runs as root. If an attacker gets code execution in the app, root inside the container makes every next step easier: writing to the app's own files, installing tools, and exploiting a kernel or runtime bug to escape. Running as an ordinary user removes that head start at no cost.

The generated files use the user each image already provides where there is one (node in the Node images, UID 65532 in distroless :nonroot, UID 101 in nginx-unprivileged) and create a system user with no home directory and no login shell for Python. Application files are copied as root, so the running app can read its code but cannot rewrite it. Root in an earlier build stage is fine and normal; only the final stage matters.

How Do Pinned Base Images and Healthchecks Work?

FROM node with no tag means node:latest, which changes whenever a new major version ships, so the same Dockerfile can build a different image next month. Every generated FROM line carries a version tag, and you can edit it. Tags can still be re-pushed with patched contents; for byte-for-byte repeatable builds, add the digest too, as in image:tag@sha256:.... This page works offline and cannot look digests up, so it tells you the command to fetch one instead.

A HEALTHCHECK tells Docker how to ask the app whether it is working. Slim images often have no curl or wget, so a healthcheck that calls curl fails forever and marks a healthy container unhealthy. The generator uses what is really in each image: Node's own http module, Python's urllib, and BusyBox wget on Alpine. Distroless images have no shell at all, so the Go file leaves HEALTHCHECK out and says to use your orchestrator's HTTP probe instead.

What Does the Dockerfile Linter Check?

Paste any Dockerfile and the linter reports findings with a line and column, grouped as errors, warnings, and notes. It joins continuation lines, skips comments and parser directives, and does not treat heredoc bodies as instructions. The rules include:

  • Unpinned or :latest base images, and a final stage that runs as root or never sets USER.
  • Secrets baked into ENV values or ARG defaults, where docker history shows them to anyone who can pull the image.
  • apt-get install without --no-install-recommends, package lists left in the layer, and apt-get upgrade inside the build.
  • COPY . . before the dependency install, npm install instead of npm ci, and pip without --no-cache-dir.
  • Shell-form CMD and ENTRYPOINT, more than one CMD in a stage, ADD where COPY would do, curl | sh, sudo, cd in RUN, the deprecated MAINTAINER, invalid EXPOSE ports, and unknown instructions.

Each rule and its reason are listed in the fold under the linter. The generated files lint clean, which is a useful check after you edit one.

How Do You Use the Generated Files?

  1. Copy the Dockerfile and .dockerignore into the root of your project, next to package.json, requirements.txt, or go.mod.
  2. Commit the lockfile the install step expects: package-lock.json, pnpm-lock.yaml, yarn.lock, a pinned requirements.txt, or go.sum.
  3. Run docker build -t app . and then the docker run command shown on the page, and open the mapped port.
  4. Check the health state with docker ps once the start period has passed.

Running it as a service on a plain Linux host instead? The systemd tool writes the unit file. Keep the .env file you use at run time out of the image with the .dockerignore, and check it with the .env validator. The repository side is covered by .gitignore.

What Other Tools Are in the Commands Lane?

  • tar: Paste a tar command to have every flag explained and the -C ordering trap flagged, or tick what you want and copy the command.
  • ffmpeg: Pick a task to get an explained ffmpeg command, decode a pasted one, or work out the bitrate for a target file size.
  • Git commands: Describe what you want to do in git, from undoing a commit to recovering a deleted branch, and get the command with a danger badge.
  • OpenSSL: Explained OpenSSL commands for keys and CSRs with SANs, self-signed certificates, inspection, PEM, PFX, and DER conversion, and chain checks.
  • systemd: Generate a systemd service and timer with restart, user, environment, and hardening options, convert cron to OnCalendar, and copy the install commands.

Elsewhere in the toolbox: UUID, .gitignore, CSP, .htaccess, and more on the 2toolbox home page. Part of the 2suite.io privacy-first ecosystem.

Frequently Asked Questions

Are the base image tags current?

They were reviewed on 2026-11-18 and are editable. Check Docker Hub for the newest supported tag of your runtime before you ship, because this page works offline and cannot look tags up.

Why does the Go image have no HEALTHCHECK?

Distroless images have no shell, curl, or wget, so there is nothing to run a check with. Use your orchestrator probe, such as a Kubernetes liveness probe, instead.

Is my Dockerfile uploaded when I lint it?

No. Linting runs in this tab, and nothing you paste is sent or stored. You can confirm it in the Network tab.

Does a clean lint mean the image is secure?

No. The linter checks common mistakes in the Dockerfile itself. Scan the built image for vulnerable packages and keep the base image updated as well.

Why npm ci instead of npm install?

npm ci installs exactly what package-lock.json lists and fails if the lockfile is out of date, so every build gets the same dependencies.

Was this helpful?