Docker Run to Docker Compose Converter
CodeConvert docker run commands into a docker-compose.yml, or a compose file back into docker run commands: ports, volumes, env, networks, healthchecks, GPUs and limits
About Docker Run to Docker Compose Converter
Paste a docker run command from a README or your shell history and get the equivalent compose.yaml service, or flip the direction and turn a docker-compose.yml into the plain docker commands that start the same containers. In the docker run to Compose direction it reads the command the way a shell would, so backslash continuations, quotes, combined flags like -it and attached values like -p8080:80 all work, and every flag with no Compose field (like --rm) is listed instead of dropped. In the Compose to docker run direction you get the network and volume create commands, a docker build for each build: service and one docker run -d per service in depends_on order, with anchors and merge keys resolved, relative bind mounts made absolute and ${VARIABLES} left for your shell. Both directions run in your browser and nothing is executed.
How to use Docker Run to Docker Compose Converter
- 1.Pick a direction. For docker run to Compose, paste one or more docker run commands, one per line or joined with &&. For Compose to docker run, paste a compose.yaml or drop the file on the input.
- 2.Read the output and the warnings under it: flags Compose can't express, $(...) substitutions it won't run and external networks in one direction; secrets, replicas, Swarm-only deploy keys and depends_on conditions docker run can't wait for in the other.
- 3.Copy the result or download it as compose.yaml or run.sh. Check a compose file with docker compose config; run the docker commands from the folder that holds the compose file, after exporting any variables your .env file sets.
Frequently asked questions
Use via API, SDK, or MCP
cURL# Free: 1,000 req/day · Pro: 10,000 req/day
curl -X POST https://api.utilix.tech/v1/tools/docker-run-to-compose \
-H "Authorization: Bearer utx_live_..." \
-H "Content-Type: application/json" \
-d '{"command":"docker run -d --name web -p 8080:80 -v ./html:/usr/share/nginx/html:ro -e TZ=UTC --restart unless-stopped nginx:alpine"}'Get an API key from your dashboard · Full API docs →