Convert docker run commands into docker-compose.yml instantly: ports, volumes, env vars, restart policies and networks mapped automatically, with multi-line and --flag=value support. Runs entirely in your browser.
TL;DR: Convert docker run commands into docker-compose.yml with one click: ports, volumes, env vars and restart policies mapped automatically, unmapped flags surfaced as warnings. Fully local, nothing leaves your browser.
For local tools, open DevTools → Network and search your input — it should not appear in requests.
Usage Guide
A long docker run command works once, but it is hard to maintain across restarts, migrations and orchestration — docker compose turns "how it runs" into a YAML file. This tool translates a docker run command into equivalent compose config, parsed as plain text locally; pasted commands never leave the browser.
1. Convert a run command
- Paste the full docker run command (with -d, -p, -v, -e, --name, --restart and friends).
- Click convert; the compose YAML appears on the right: port maps land in ports, env vars in environment, volumes in volumes, restart policy in restart.
- Save the result as docker-compose.yml and verify once with docker compose up -d.
2. Three manual checks after converting
- Image and tag: make sure the image field matches the run command exactly — a missing tag silently pulls latest, which may behave differently.
- Volume paths are host paths: absolute binds need editing when the compose file moves; relative paths resolve against the compose file directory.
- Startup order: the manual "start the database first" sequence must be expressed with depends_on — the converter will not guess dependencies.
3. Why migrating to compose is worth it
A run command lives only in the session that typed it — after a machine restart it survives in shell history or human memory. A compose file goes into version control: reviewable, rollback-able, reproducible on any machine. The team variant of "works on my machine", container edition, is almost always an unconverted run command.
FAQ
The common 90%: -p ports, -v volumes, -e env vars, --env-file, --name, --restart, --network, -h, -u, -w, --entrypoint, -m, --cpus, --privileged, --mount (bind/volume), plus the container command after the image. Unknown flags never break the conversion — they are listed as warnings for manual review.
A bare -e DEBUG (without =value) passes a host environment variable through, which a compose file cannot express. Rewrite it as -e DEBUG=value and convert again.
At least three spots: a missing image tag silently means latest and behavior may drift; volume paths are host-machine absolutes that break on another box; service dependencies must be expressed with depends_on, which the tool will not guess for you. And keep secret env vars out of any public repo along with the compose file.
Save it as docker-compose.yml and run docker compose up -d once to verify; modern docker compose (v2) needs no version field, which is exactly the format emitted here. A run command lives only in the shell session that typed it, while a compose file in version control is reviewable, revertible, and copyable to any machine.
No. Translation and YAML generation run entirely inside your browser with zero network requests, so commands with passwords or internal hosts can be pasted as-is — just scrub secrets before committing the generated file to Git.
Related Tools
Related Articles
Container Name Is Already in Use: Resolving the Conflict Error
docker run fails with Conflict. The container name /xxx/ is already in use? An old container with the same name still exists — stopped containers keep their names too. Covers finding the squatter with docker ps -a, rm -f to free it, compose down for project leftovers, --rm for one-shot runs, and restart-policy resurrections.
Docker port is already allocated: Finding and Freeing the Taken Port
docker run fails with port is already allocated or bind: address already in use? The host-side port you mapped is taken — by another container's docker-proxy or a host process. How to tell the two apart, the compose project-name collision scenario, and why 127.0.0.1 and a specific IP binding can coexist.
docker pull access denied: 5 Reasons Image Pulls Get Rejected (and the Fix)
docker pull fails with pull access denied for xxx, repository does not exist or may require docker login? Covers misspelled image names, missing tags, private registry login, Docker Hub rate limits, and registry mirrors for mainland China networks — with a one-minute triage flow.