Docker Run to Docker Compose Converter

Convert a docker run command into a docker-compose.yml service. Handles ports, volumes, env vars, name, restart, network and command.

About this tool

Paste a docker run command (backslash line continuations are fine). Supported flags: -p, -v, -e, --name, --restart, --network, -u, -w, -h, --entrypoint, --privileged, -it, plus the trailing command. Unsupported flags are ignored, so review the output before use. Runs in your browser.

Related: JSON Formatter & Validator · Base64 Encode & Decode · URL Encoder & Decoder · SHA-256 / SHA-1 Hash Generator · Unix Timestamp Converter

Frequently asked questions

How do docker run flags map to Compose?

-p becomes ports, -v becomes volumes, -e becomes environment and --name becomes container_name.

Does the output need edits?

Review image tags and secrets before committing; avoid putting real passwords in the file.

Which Compose version applies?

The generated file omits the obsolete version key, which modern Compose ignores.