docker run to Compose
Convert docker run flags into docker-compose.yml
docker-compose.yml
—
About the docker run to Compose
The docker run to Compose Converter turns a long command into a compose service. It maps the image, published ports, volumes, environment variables, restart policy, network, and trailing command into YAML.
Moving a one-off container into compose makes it reproducible. Compare the generated file with the original command, then commit it so the next person does not have to reverse-engineer the flags.
- ✓Ports, volumes, and environment mapping
- ✓Restart and network settings
- ✓Service name from --name
How to use the docker run to Compose
- 1
Paste a docker run command.
- 2
Choose whether to include a version field.
- 3
Copy the generated YAML.
Frequently asked questions
Why is my command missing?+
Only the arguments after the image are treated as the command. Flags this tool does not recognize are dropped, so check the generated YAML before running it.
Do I still need the version field?+
No. Modern Compose ignores it. It is included only as an option for older tooling that still expects it.
Save docker run to Compose to your favorites, or keep browsing developer tools.
Browse all 35 developer tools →