Account

What new tool do you want?

Developer Tools

Dockerfile & docker-compose Generator

Generate a production-ready Dockerfile and docker-compose.yml for Node.js, Python or static sites — with PostgreSQL, MySQL, Redis or MongoDB services.

How to use

  1. 1Pick your app runtime, port and the services you need.
  2. 2Copy the Dockerfile and docker-compose.yml into your project and run docker compose up.

Frequently asked questions

Where do I put passwords?

In a .env file next to docker-compose.yml (never commit it). The generated compose file reads variables like ${POSTGRES_PASSWORD}.

Why a multi-stage Dockerfile?

Dependencies are built in one stage and only what's needed is copied to a slim final image — smaller, faster and more secure.

How do I keep database data?

Named volumes (e.g. pgdata) are created so data survives container restarts and rebuilds.

Why the Node Dockerfile has two FROM lines

The generated Node Dockerfile is multi-stage: a deps stage runs npm ci --omit=dev to install only production dependencies, and the final stage copies just the resulting node_modules folder and your source into a fresh, slim image rather than carrying over every build tool, cache file and dev dependency that accumulated along the way. The final image also runs as the non-root `node` user rather than root — a deliberate security default, since a container running as root that gets compromised hands the attacker root inside the container.

Worked example: Dockerfile & docker-compose Generator

Pick Node.js, port 3000, and PostgreSQL with Redis enabled. The generated compose file wires app's depends_on so it waits for db's healthcheck (pg_isready) to report service_healthy — not just "container started," which matters because Postgres can take a second or two after its process launches before it's actually ready to accept connections — and for redis using condition: service_started, since Redis starts accepting connections almost immediately. You also get a DATABASE_URL environment variable pre-wired to postgres://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB:-app} and a named pgdata volume, so a docker compose down and back up doesn't wipe your database.

Why passwords aren't filled in

Every credential in the output is a shell variable reference like ${POSTGRES_PASSWORD} rather than a literal value, because the generator has no way to create a secret for you safely — and more importantly, a real secret belongs in a .env file (gitignored) next to docker-compose.yml, never hardcoded into a file you might commit. Docker Compose reads .env automatically and substitutes these variables at startup, so the only step left after generating is creating that .env file with real values before running docker compose up.

The one database choice that waits for readiness — and the two that don't

Only the PostgreSQL option gets a healthcheck block (test: pg_isready) and a depends_on entry with condition: service_healthy, which makes the app container genuinely wait until Postgres is accepting connections before it starts. Pick MySQL or MongoDB instead and the generator falls back to the plain depends_on: [- db] array form, which only waits for the database container to start, not for the database engine inside it to finish booting — MySQL in particular can take several seconds after its process launches before it accepts connections. In practice this means a Node or Python app that opens its database connection in a startup script can crash-loop a few times against MySQL or Mongo before the engine catches up, something that doesn't happen with the Postgres path. The fix is the same one production setups use regardless: add your own retry/backoff around the first connection attempt, since depends_on alone was never a substitute for connection-level retry logic.

Related tools

More: Developer Tools