Developer Tools
Docker Compose Generator - Service Configuration Builder
Build docker-compose.yml files visually. Add multiple services with images, ports, environment variables, volumes, depends_on, and restart policies, then copy the generated YAML.
Your inputs are saved in this browser only. No data is ever sent to a server, and saved values won't be visible in other browsers or devices.
Service 1
Ports (host:container)
Environment variables
Volumes
Depends on
docker-compose.yml
version: '3.9'
services:
app:
image: nginx:latest
restart: unless-stoppedWhat is Docker Compose?
Docker Compose is a tool for defining and running multi-container Docker applications. You
describe your services, networks, and volumes in a docker-compose.yml file, then start
everything with a single command: docker compose up.
Key concepts
- Service: a container defined by an image and configuration. Each service runs one container image (e.g., a web server, a database, a cache).
- Image: the read-only template for the container, pulled from Docker Hub or a registry.
- Volumes: persistent storage that outlives the container’s lifecycle. Mount a volume to keep database data between restarts.
- Networks: Compose creates a default network so all services can communicate
by service name (e.g.,
postgresorredis). - Ports: map a container port to a host port (
hostPort:containerPort). Only expose ports you actually need. - Environment variables: pass configuration into containers. Prefer
.envfiles for secrets rather than hardcoding them in the YAML.
Common commands
| Command | Description |
|---|---|
docker compose up -d | Start all services in detached (background) mode |
docker compose down | Stop and remove containers and networks |
docker compose logs -f | Follow log output from all services |
docker compose ps | List running services and their ports |
docker compose pull | Pull latest images for all services |
docker compose exec service bash | Open a shell inside a running service |