Free online tool. All processing is client-side. No signup needed.
A Docker Run to Docker Compose Converter transforms long, complex `docker run` commands into clean, readable Docker Compose YAML files. Docker Compose is the standard for multi-container Docker applications, but most tutorials and quick-start guides provide `docker run` commands — which are easy to copy-paste but hard to maintain. This converter automatically detects volumes, ports, environment variables, networks, and restart policies from the run command and structures them into a proper Compose service definition.
Paste a docker run command (e.g., `docker run -d --name mydb -p 5432:5432 -v pgdata:/var/lib/postgresql/data -e POSTGRES_PASSWORD=secret postgres:16`). The converter parses each flag: --name → container_name, -p → ports, -v → volumes, -e → environment, --network → networks, --restart → restart, --cap-add/--cap-drop → cap_add/cap_drop, --dns → dns. The output is valid Docker Compose YAML that can be pasted directly into docker-compose.yml.
docker run Flag → Compose Mapping:\n• --name → container_name\n• -p host:container → ports: \
Paste one at a time to generate the corresponding service. Then combine all service definitions under the `services:` key in a single docker-compose.yml. Each docker run becomes one service.
No, they work together. Dockerfile defines HOW to build an image; docker-compose.yml defines HOW to RUN containers from images (built or pulled). Your compose file can reference both pre-built images and Dockerfiles via the `build:` directive.
Free online Docker Run To Docker Compose Converter — no signup, 100% client-side processing. All data stays in your browser.