Docker Run ↔ Compose
Paste a docker run command and get an equivalent docker-compose.yml. 100% client-side — nothing leaves your browser.
docker run -d --name my-app -p 8080:80 my-image:latest
Quick Recipes
Click a recipe to load a common docker run command and see its compose equivalent.
Docker Run to Docker Compose — Migration Guide
Docker Compose is the standard way to define and run multi-container Docker applications. While docker run is great for quick one-off containers, production deployments benefit from the declarative, version-controlled nature of docker-compose.yml files.
Why Migrate from docker run to Compose?
- Reproducibility — compose files are declarative and version-controlled
- Multi-service orchestration — define networks, volumes, and dependencies between containers
- Easier management —
docker compose up/downmanages the full stack - Environment parity — same file works in dev, staging, and production
- Documentation — the compose file documents your infrastructure
docker run vs docker-compose.yml
| docker run flag | Compose equivalent | Example |
|---|---|---|
| --name | container_name | container_name: my-app |
| -p 8080:80 | ports | - "8080:80" |
| -v ./data:/app | volumes | - ./data:/app |
| -e KEY=val | environment | - KEY=val |
| --restart unless-stopped | restart | restart: unless-stopped |
| --network my-net | networks | networks: [my-net] |
| --privileged | privileged | privileged: true |
| --cpus / --memory | deploy.resources.limits | cpus: "0.5", memory: 512M |
| --gpus all | deploy.resources.reservations | devices: [nvidia, gpu] |
Supported Flags
This converter supports 40+ docker run flags including ports (-p), volumes (-v, --mount), environment variables (-e, --env-file), networking (--network, --dns), security (--privileged, --cap-add/drop, --security-opt), resources (--cpus, --memory, --gpus), healthchecks, logging, labels, ulimits, sysctls, and more. Multi-line commands with backslash continuation are supported. Unrecognized flags are reported as warnings.
Need to create the Dockerfile itself? Use our Dockerfile Generator to build production-ready, multi-stage Dockerfiles with security hardening and best-practice validation.
Privacy First
All parsing happens entirely in your browser using JavaScript. Your docker run commands, environment variables, passwords, and configuration are never sent to any server. This tool has zero backend dependencies.