Generators

Generate a starter docker-compose.yml

The Docker Compose generator writes a starter docker-compose.yml you can save next to an app and run with docker compose up. You set the service name, the image (node:20-alpine by default) and the port, and it fills in a single service that publishes that port, sets NODE_ENV=production, mounts the project folder at /app and restarts unless stopped. It gives you a known-good base file instead of YAML typed from memory. No version: line is written, since Compose v2 treats that key as obsolete.

How to use Docker Compose Gen

  1. Open Docker Compose Gen in the Toolbox101 app; the starter file is already in the Output box.
  2. Set Service, Image and Port for your project. A bad value, such as a port above 65535 or an image with a space, is reported in the Output box.
  3. Read the YAML in the Output box: one service with the image, the published port, NODE_ENV, a bind mount and a restart policy.
  4. Click Copy, save it as docker-compose.yml beside your project and run docker compose up -d from that folder.
  5. Add anything else, such as more environment variables, volumes or services, by editing the copied YAML.

Worked example

Docker Compose Gen returns the output below.

Output

services:
  app:
    image: node:20-alpine
    ports:
      - "3000:3000"
    environment:
      - NODE_ENV=production
    volumes:
      - .:/app
    restart: unless-stopped

Check it yourself: open Docker Compose Gen.

Frequently asked questions

What does the generated compose file contain?

One service, named app by default, that pulls the image you chose, publishes the port you chose (host and container use the same number), sets NODE_ENV=production, bind-mounts the current directory at /app and restarts unless stopped. Save it next to a project and docker compose up starts the stack.

Can I change the image, port and service name?

Yes, in the Service, Image and Port boxes above the output. The tool checks them: the service name can use letters, digits, ., _ and -, the image cannot contain spaces, and the port must be 1 to 65535.

Is this compose file ready for production?

No, treat it as a local development starter. It has a restart policy but no healthcheck, resource limits or secrets handling, and it mounts the working directory over /app. For production, add those pieces or use a platform-managed container service, and check any edits with docker compose config.

Do I need Docker installed to use this generator?

No. The YAML is assembled in your browser, so you can generate and copy the file on any machine. Docker is needed only when you run the stack: docker compose up needs the Docker engine and the Compose plugin on the machine that starts the containers.

Use Docker Compose Gen now

Runs in your browser. Nothing you type is uploaded.