Docker Run to Compose
Nothing is executed. Unknown flags are listed, not dropped silently.
compose.yaml
Paste a docker run command to build Compose YAML.
Convert docker run to Compose YAML
Map common flags (−p, −e, −v, −−name, −−restart, −−memory, −−cpus) to a services block. Quotes are tokenized; the command is never eval’d or executed. For YAML pretty-print of existing files see the JSON to YAML converter.
Docker run to Compose FAQ
- What is a docker run to Compose converter?
- It turns a docker run (or docker create) command into Compose YAML with a services block you can copy into compose.yaml. This page does not run Docker.
- Which Compose version is this?
- A Compose specification services: mapping (compose.yml v3-ish). It is not the old docker-compose v1 binary format.
- What happens to --rm?
- --rm has no Compose equivalent. The converter warns and omits it. Compose does not delete the container on exit the way docker run --rm does.
- Can I convert several docker run commands?
- v1 maps one command to one service. Paste one docker run at a time. Unknown flags such as --gpus are listed as warnings instead of being dropped silently.
- Does this execute the command?
- No. Toolshelf only tokenizes quotes and maps flags in your browser. Quotes must be closed or you get an error.
Related tools
Continue with related browser-based tools on Toolshelf.
- Cron Expression Generator — Online cron expression generator and explainer.
- Code Formatter & Beautifier — Online code formatter and beautifier.
- JSON to YAML Converter — JSON to YAML converter online.
- Chmod Calculator — Chmod calculator online.
- JWT Decoder & Inspector — Online JWT decoder and inspector.
- HTTP Status Codes — HTTP status codes lookup online, plus MIME types and a Basic Auth header builder.
- MAC Address Lookup — MAC address lookup online.
- Regex Tester — Online Regex Tester and Debugger.
Examples
Publish nginx
docker run -p 80:80 nginx becomes a services.nginx block with ports 80:80.
Limitations
- One docker run maps to one service.
- Unknown flags are warnings, not silent drops.
- --rm has no Compose equivalent.
- The command is not executed.
What would you like to do next?
Continue working with the next step in this workflow. Recently used tools in this set are listed first.
- Cron Expression Generator — Online cron expression generator and explainer.
- Code Formatter & Beautifier — Online code formatter and beautifier.
- JSON to YAML Converter — JSON to YAML converter online.
- Chmod Calculator — Chmod calculator online.
You may also need
Continue with related browser-based tools on Toolshelf.
- Cron Expression Generator — Online cron expression generator and explainer.
- Code Formatter & Beautifier — Online code formatter and beautifier.
- JSON to YAML Converter — JSON to YAML converter online.
- Chmod Calculator — Chmod calculator online.
- JWT Decoder & Inspector — Online JWT decoder and inspector.
- HTTP Status Codes — HTTP status codes lookup online, plus MIME types and a Basic Auth header builder.
- MAC Address Lookup — MAC address lookup online.
- Regex Tester — Online Regex Tester and Debugger.