Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

Dockerfile & Docker Compose Generator

Pick a stack or drop package.json: get a lean, checked Dockerfile and a compose stack.

Free preview, no sign-upIncluded in your pass Pro tool Pro pass: ₹179 / $5.99 for 30 days On this device: nothing is sent
+3 +1 more details No uploadWorks offline once opened Developer

Free preview: the build stages of the Dockerfile and the list of files it makes, with every check. Locked until you unlock it: download and copy.

Pro pass ₹179 for 30 days or ₹79 for 1 week, one‑time. Pro pass $5.99 for 30 days or $2.99 for 1 week, one‑time. How to unlock

Try before you buy.

  • Free preview: the build stages of the Dockerfile and the list of files it makes, with every check.
  • Locked until you unlock it: download and copy.
  • Unlock: Pro pass, ₹179 for 30 days or ₹79 for 1 week, a one-time payment that never renews. Unlock: Pro pass, $5.99 for 30 days or $2.99 for 1 week, a one-time payment that never renews.

Ways to unlock shows how to get the full result.

See passes (opens in a new tab)

Printing this result is locked in the free preview.

Your project

Stack

The app's stack

The compose service and image name: lower case, digits, - and _.

Clear it for no health check.

Image family
Build and start
Package manager

The package.json script name (build); empty when nothing is built.

Dependencies
Server
Build tool
Web server
PHP extensions
Environment variables

Plain settings become defaults in the image. Names with PASSWORD, TOKEN, SECRET or KEY are secrets: they never go into the image, only into .env.example, empty.

Docker Compose
Services
HTTPS reverse proxy
Publish the app’s port on

Next steps Done. What next?

Start over

A Pro pass unlocks the full result. See passes

All developer tools

About the Dockerfile & Docker Compose Generator

Choose your stack — Node.js, Next.js (standalone), a static site served by nginx, Python behind gunicorn or uvicorn (pip, Poetry or uv), Django, Go, Rust, Java with Maven or Gradle, .NET (ASP.NET Core), PHP or Laravel on Apache or PHP-FPM with nginx — or drop package.json, requirements.txt, pyproject.toml, go.mod, Cargo.toml, pom.xml, build.gradle, composer.json or a .csproj and the page sets the stack, versions and commands for you.

You get a multi-stage Dockerfile that follows each official image: base images pinned to a supported version line, dependencies installed before the source is copied so a code change does not reinstall them, BuildKit cache mounts, an unprivileged user in the image that runs, a HEALTHCHECK where the image has a tool for one, and the exec form for the command so the app receives docker stop’s SIGTERM. A matching .dockerignore keeps .git, local .env files and build folders out of the build.

Tick Docker Compose to add a compose.yaml with PostgreSQL, MySQL, MariaDB, Redis, Valkey, MongoDB or RabbitMQ — each with a named volume, a healthcheck and the app waiting for it with depends_on: condition: service_healthy — an .env.example for the passwords, and an optional HTTPS reverse proxy for your domain: Caddy with its Caddyfile, or Traefik with Let’s Encrypt labels. Every Dockerfile is checked with the Dockerfile Linter’s rules and every compose.yaml is resolved by the Docker Compose Visualizer’s parser before you see it. Nothing is uploaded. Without a pass the result is a free preview: the build stages of the Dockerfile, the list of files and every check; the image that runs, the other files and the ZIP unlock with a Pro pass.

How to use it

  1. Drop your project files (package.json and its lockfile, requirements.txt, pyproject.toml, go.mod, Cargo.toml, pom.xml, build.gradle, composer.json or a .csproj), or pick the stack yourself.
  2. Check what was detected and adjust the version, the image family (Debian slim, Alpine or distroless), the port, the health check path and the build and start settings.
  3. Add environment variables as KEY=value lines: plain settings become defaults in the image, and secrets (names with PASSWORD, TOKEN, SECRET or KEY) go only into .env.example as empty lines.
  4. Tick Docker Compose for databases and a cache, and choose Caddy or Traefik with your domain for HTTPS.
  5. Read the checks, look through the files, and get the ZIP or copy a file with a Pro pass (without one the page shows the free preview); then run the commands under “Run it”.

Examples

A Next.js app with pnpm
Input
package.json with next, packageManager pnpm@10, engines.node ">=22"
Result
node:24-trixie-slim stages deps → build → runtime; .next/standalone and .next/static copied; USER node; CMD ["node", "server.js"]
FastAPI with uv and PostgreSQL behind Caddy
Input
pyproject.toml + uv.lock · Compose: PostgreSQL · Caddy · api.example.com
Result
uv sync --locked --no-editable in the build stage; python:3.14-slim-trixie runtime as user app; compose.yaml with postgres:18-alpine (pg_isready), DATABASE_URL from .env, and Caddy serving https://api.example.com
A Go service in a distroless image
Input
go.mod with module github.com/acme/orders-api and go 1.26.3
Result
golang:1.27-trixie build with CGO_ENABLED=0 and cache mounts; gcr.io/distroless/static-debian13:nonroot runtime with ENTRYPOINT ["/app/orders-api"]

Common uses

  • Containerising an existing app without copying a Dockerfile from a blog post that runs as root.
  • Moving a project to a VPS with its database, cache and HTTPS in one compose.yaml.
  • Getting a smaller, safer image: build tools stay in the build stage, the runtime image has only what the app needs.
  • Starting a new service with the build cache, health check and .dockerignore right from the first commit.

What each Dockerfile does

  • Node.js and Next.js: npm ci, pnpm install --frozen-lockfile or yarn install --immutable in a dependencies stage, the build in its own stage, and only the production dependencies and the build output in the image. Node.js 25 and later images no longer include Corepack, so the generator installs it there for pnpm and Yarn. Next.js copies .next/standalone and .next/static, as its official example does.
  • Python and Django: a virtual environment (pip), Poetry’s in-project environment or uv sync --locked --no-editable in the build stage, copied into a slim runtime with PYTHONUNBUFFERED=1; gunicorn or uvicorn starts the app, and Django can run collectstatic while building.
  • Go and Rust: a static Go binary (CGO_ENABLED=0, -trimpath) or a release Cargo binary, built with cache mounts, then copied alone into distroless, Alpine or Debian slim.
  • Java: Maven or Gradle (or your wrapper) builds the JAR; Eclipse Temurin JRE, Alpine or distroless runs it with -XX:MaxRAMPercentage=75.
  • .NET: dotnet restore and dotnet publish -a $TARGETARCH in the SDK image, the ASP.NET Core runtime with the images’ own non-root user (USER $APP_UID) on port 8080.
  • PHP and Laravel: Composer without dev packages, extensions through install-php-extensions, PHP’s production php.ini, and Apache on an unprivileged port — or PHP-FPM plus an nginx target, with Laravel’s documented server block.

Health checks that work in each image

A HEALTHCHECK must use a program the image has. Node.js images check with node -e and fetch(), Python images with urllib, Alpine images with BusyBox wget, PHP’s Apache image with curl, and PHP-FPM with an FPM ping through cgi-fcgi. JRE, Debian and .NET runtime images have no HTTP client, so the generator installs curl for the check. Distroless and chiseled images have no shell or HTTP client at all: their Dockerfile says HEALTHCHECK NONE with the reason, and your orchestrator’s HTTP probe takes over. Django needs 127.0.0.1 in ALLOWED_HOSTS for its check to pass.

Compose services and HTTPS

  • Every service has a named volume and a healthcheck: pg_isready for PostgreSQL 18 (its data lives under /var/lib/postgresql), mysqladmin ping for MySQL, the image’s healthcheck.sh for MariaDB, a password-protected PING for Redis and Valkey, mongosh for MongoDB and rabbitmq-diagnostics -q ping for RabbitMQ.
  • Passwords are read from .env as ${NAME:?…}, so Compose refuses to start while one is missing, and the app gets its connection string (DATABASE_URL, REDIS_URL, MONGODB_URI, AMQP_URL, or Laravel’s DB_*).
  • Caddy gets its certificates by itself; Traefik uses a Let’s Encrypt resolver (it needs an e-mail address) and reads labels through the Docker socket, which the checks explain. Without a proxy the app is published on 127.0.0.1 unless you choose every interface.
  • MinIO is not offered: its repository was archived and the community edition is distributed as source code only, with no further releases. Use your cloud’s object storage or another maintained S3-compatible store.

Images and sources

Base images are pinned to a version line (node:24-trixie-slim, python:3.14-slim-trixie, golang:1.27-trixie, rust:1.99-slim-trixie, eclipse-temurin:25-jre, mcr.microsoft.com/dotnet/aspnet:10.0, php:8.5-apache, nginxinc/nginx-unprivileged:1.30-alpine), so rebuilds get security fixes without jumping a major version. To pin an exact image, run docker buildx imagetools inspect <image> and add @sha256:<digest> to the FROM line. Sources: Dockerfile reference, Docker build best practices, Compose file reference, Docker Official Images, Next.js Docker example, uv in Docker, .NET container images, Distroless, Laravel deployment.

Limitations

  • The page writes files; it cannot build or run them. Try the image locally with docker build and docker run before you deploy it.
  • Version lines are the ones the generator knows; type another version if its image exists, and check new major versions against your app.
  • Monorepos, private package registries, native build dependencies and apps that read files outside the build folder need edits the generator cannot guess: each Dockerfile says where.
  • Docker Swarm, Kubernetes manifests and CI pipelines are not written here; the Kubernetes Manifest Generator covers manifests.

Privacy

On this device: nothing is sent

Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot.

Frequently asked questions

What do I get without a pass?

Without a pass, Dockerfile & Docker Compose Generator shows the build stages of the Dockerfile and the list of files it makes, with every check. Until you unlock it, the result can’t be downloaded or copied. A Pro, Premium or Ultimate pass, a one-time payment that never renews, unlocks the full result. The pricing page lists the passes and their prices.

Why are there several FROM lines?

That is a multi-stage build: compilers, dev dependencies and source code stay in the build stages, and the final image gets only what the app needs to run. Images are smaller, have fewer packages to patch and build faster thanks to the layer cache.

Why does the image run as a non-root user?

If someone breaks into the app, they get an unprivileged account in the container instead of root. The images use the user their base image provides (node, www-data, the .NET app user, distroless nonroot) or one the Dockerfile creates (app, UID 10001). That is also why the app listens on a port from 1024 up: publish it as 80 or 443 on the host, or put the proxy in front.

Where do my passwords go?

Nowhere in the image. Variables whose names contain PASSWORD, TOKEN, SECRET or KEY are left out of the Dockerfile; compose.yaml reads them from a .env file you create from .env.example, which stays out of the image (the .dockerignore excludes it) and should stay out of Git.

Alpine, Debian slim or distroless?

Debian slim is the safe default: glibc, so prebuilt binaries and wheels work. Alpine is smaller but uses musl, so some native packages must be compiled. Distroless (and .NET’s chiseled images) contain no shell or package manager, which shrinks what an attacker can use, but you cannot exec into a shell to debug and the image has no HTTP client for a health check.

Does it work with docker compose watch or Kubernetes?

The Dockerfile works anywhere an OCI image runs, Kubernetes included (Kubernetes ignores HEALTHCHECK and uses its own probes on the same path). compose.yaml targets Docker Compose v2; add a develop: watch section yourself for live reload during development.

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.