Docker Compose Generator

Generate a docker-compose.yml with app, database and cache services.

  • Runs locally in your browser
  • No upload required

Try it

File
docker-compose.yml
Services
app, db, cache
Volumes
db-data, app-data
Content
# Generated in the browser — review this file and adapt it to your project before committing. name: myapp services: app: image: ghcr.io/example/myapp:latest restart: unless-stopped ports: - "3000:3000" depends_on: - db - cache environment: - NODE_ENV=production - DATABASE_URL=postgres://app:${POSTGRES_PASSWORD}@db:5432/app - REDIS_URL=redis://cache:6379 volumes: - app-data:/data db: image: postgres:16-alpine restart: unless-stopped environment: - POSTGRES_USER=app - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD} - POSTGRES_DB=app volumes: - db-data:/var/lib/postgresql/data cache: image: redis:7-alpine restart: unless-stopped ports: - "6379:6379" volumes: db-data: app-data:
# Generated in the browser — review this file and adapt it to your project before committing.
name: myapp
services:
  app:
    image: ghcr.io/example/myapp:latest
    restart: unless-stopped
    ports:
      - "3000:3000"
    depends_on:
      - db
      - cache
    environment:
      - NODE_ENV=production
      - DATABASE_URL=postgres://app:${POSTGRES_PASSWORD}@db:5432/app
      - REDIS_URL=redis://cache:6379
    volumes:
      - app-data:/data
  db:
    image: postgres:16-alpine
    restart: unless-stopped
    environment:
      - POSTGRES_USER=app
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD}
      - POSTGRES_DB=app
    volumes:
      - db-data:/var/lib/postgresql/data
  cache:
    image: redis:7-alpine
    restart: unless-stopped
    ports:
      - "6379:6379"
volumes:
  db-data:
  app-data:

Supported formats

Input
text
Output
text

Privacy

Runs entirely in your browser. Your input is never uploaded, stored, or sent to a third party.

Processing
In your browser
Privacy level
Browser only

Generated a Compose file with 3 service(s).

How it works

  • Named the project "myapp" and declared the services mapping.
  • Added: app, db, cache.
  • Declared the named volume(s): db-data, app-data.
  • Referenced passwords through environment variables rather than writing a value.
  • Compose v2 no longer needs a top-level `version:` key, so none is emitted.
  • Set the referenced environment variables before running `docker compose up`.

Methodology

  1. Emit the project name and the `services:` mapping.
  2. For each selected preset emit its image, restart policy, ports, environment references and volumes.
  3. Declare every referenced named volume under a top-level `volumes:` key.

Usage

  1. Name the project and decide whether to include the application service.
  2. Choose a database and a cache preset.
  3. Run the generator and copy or download the docker-compose.yml.

Examples

These are examples, not current values: they use fixed inputs, while the interactive tool computes live results in your browser.

App with Postgres and Redis

jsonSelect to copy
{
  "projectName": "myapp",
  "app": true,
  "appImage": "ghcr.io/example/myapp:latest",
  "appPort": 3000,
  "database": "postgres",
  "cache": "redis",
  "volume": true
}

Postgres only

jsonSelect to copy
{
  "projectName": "database",
  "app": false,
  "appImage": "postgres:16-alpine",
  "appPort": 5432,
  "database": "postgres",
  "cache": "none",
  "volume": true
}

Limitations

How the generated file handles configuration

The application service points at the database and cache by service name, which Compose resolves on its internal network. Passwords are always read from environment variables so the file is safe to commit.

The file is a starting point: add healthchecks, resource limits and production-specific networks as needed.

Frequently asked questions

Why is there no `version:` key?
The Compose specification deprecated the top-level `version` key. Modern Docker Compose reads the file without it, so the generator omits it.
Are database passwords written into the file?
No. The file references variables such as `${POSTGRES_PASSWORD}` that you set in your shell or an `.env` file, so no secret is committed.

Sources

  1. Compose specification — Docker
  2. Docker Compose overview — Docker