What this converter does
A docker run command that started as a quick experiment tends to grow: ports, volumes, environment variables, a network, a restart policy. At some point it belongs in a compose.yaml. This converter parses one or more docker run commands and produces a clean Compose file with one service per command. It also works in reverse: paste a Compose file and get the equivalent docker run commands, which is handy for debugging a single service or running it on a host without Compose. Parsing happens locally in your browser.
How to use it
- Select docker run → compose or compose → docker run.
- Paste your commands, one per line. Backslash line continuations are fine, and a leading
sudois ignored. - Review the generated YAML. Named volumes and custom networks are declared at the top level automatically.
- Read the notes for options that have no Compose equivalent.
- Copy the output, save it as
compose.yamland rundocker compose up -d.
Supported options
Ports (-p, --expose), environment (-e, --env-file), volumes and mounts (-v, --mount, --tmpfs), networking (--network, --network-alias, --ip, --hostname, --add-host, --dns, --link), restart policy, user and working directory, entrypoint and command, labels, logging driver and options, health checks (--health-*), resource limits (--memory, --cpus, --shm-size, --ulimit, --gpus), security options (--privileged, --cap-add, --cap-drop, --security-opt, --read-only), devices, sysctls, --init, --platform, --pull, -it and more.
Tips
- Service names come from
--name; if absent, the image name is used. --rmand-dhave no meaning in Compose and are dropped with a note.- Relative bind mounts in Compose are resolved relative to the Compose file, not your shell's directory. Use
./datastyle paths. - Secrets passed with
-eend up in plain text. Consider moving them to an.envfile and referencing${VAR}.