Advertisement
Guide
About the docker run to Compose Converter
Long docker run commands are painful to maintain — they end up buried in shell history or a README, and every change means re-typing a wall of flags. Moving to Docker Compose makes the same configuration declarative, version-controllable, and easy to bring up with one command.
Paste one command — or a whole script of them — and this tool produces the equivalent docker-compose.yml, one service per command, translating each flag to its Compose key. Anything it doesn't recognise is reported rather than silently dropped.
How the flags map
-p→ports-v→volumes-e→environment--name→container_name--restart→restart--network→networks, ornetwork_modefor host, none and container:…--health-cmd→healthcheck.testasCMD-SHELL--gpus→deploy.resources.reservations.devices-w/-u→working_dir/user
Why move to Compose
Compose turns run-time flags into a file you can commit. That means the configuration is reviewable in pull requests, reproducible across machines, and easy to extend when you add a database or cache alongside your app. Starting everything becomes docker compose up -d.
What to check afterwards
A few flags have no direct Compose equivalent or depend on your setup — -d and --rm are run-time behaviours rather than config, and named networks are emitted as external: true on the assumption they already exist. Review the output before running it in production.
How to use it
- 1Paste your docker run command, or several of them (multi-line with \, ` or ^ continuations is fine).
- 2Read the generated docker-compose.yml on the right.
- 3Check the Notes section for any flags that could not be mapped.
- 4Copy or download the file and run docker compose up -d.
- 5Switch to Diagram — or to Visualize a compose file to paste an existing one — to see how the services connect.
Frequently asked questions
Does it handle multi-line commands?
Yes. Line continuations for bash (\), PowerShell (`) and cmd (^) are joined automatically, so you can paste a command exactly as it appears in a README or script.
Can I convert several containers at once?
Yes. Paste several docker run commands and each becomes a service in the same file. Other docker commands in the paste, such as docker network create, are skipped and listed under Notes.
Why does my named volume have a name: line?
Compose prefixes volume names with the project name, so without it you would get a new, empty volume instead of the one docker run created. name: keeps using the existing data.
What happens to flags it does not support?
They are listed under Notes rather than dropped silently, so you know exactly what to add by hand.
Why is my network marked external: true?
A --network flag refers to a network that already exists, so the output assumes it is external. If Compose should create it instead, remove that line.
What about -d and --rm?
Those control how a container is run, not how it is configured, so they have no Compose equivalent. Use docker compose up -d for detached mode.
Can it draw a compose file I already have?
Yes. Choose Visualize a compose file and paste it. Each service is a box with its image, ports, bind mounts and networks; named volumes hang underneath; solid arrows are depends_on and dashed arrows are connections found in environment variables. Open in Mermaid exports the picture as PNG or SVG.
What problems does it check for?
depends_on or network_mode pointing at a service that does not exist, two services publishing the same host port, named volumes and networks used but not declared, a wait for service_healthy on a service with no healthcheck, depends_on loops, and services with neither image nor build.
Is my command sent anywhere?
No. Parsing and YAML generation happen entirely in your browser.
