Docker Run to Compose — Convert a docker run Command to docker-compose.yml (free, no upload)
Convert a docker run command into an equivalent docker-compose.yml — ports, volumes, env vars, name, restart, network and workdir. Free, in your browser.
Paste a docker run command and get an equivalent docker-compose.yml. The service is named after the image until you type a name of your own. Ports, volumes, env vars, --name, --restart, --network, --workdir and the trailing command are mapped, and so are some fifty more flags — --cap-add, --device, --dns, --entrypoint, --expose, --add-host, --health-cmd, --hostname, --label, --log-driver, --log-opt, --security-opt, --sysctl, --tmpfs, --ulimit, --user, -i/-t, --privileged, --read-only and the cpu/memory family. Run-only flags such as -d are ignored, and anything else the command carries is listed under the result rather than dropped in silence.
🔒 Converted in your browser — nothing is uploaded.
Turn a docker run command into a Compose file
Paste a docker run … command and this tool writes the equivalent docker-compose.yml service for you. Published ports, mounted volumes, environment variables, the container name, restart policy, network, working directory and the trailing command are all mapped to their Compose keys, so you can move a one-off docker run into a version-controlled Compose file in seconds. Everything runs in your browser — the command never leaves your device.
Which flags are converted
-p/--publish→ports-v/--volume→volumes-e/--env→environment--name→container_name--restart→restart--network→networks-w/--workdir→working_dir- the image and any trailing arguments →
imageandcommand
Both spellings -p 8080:80 and -p=8080:80 are accepted. -i and -t (together, -it) become stdin_open: true and tty: true; -d, --rm and -P only affect that one run and are dropped. Every other flag is still read as a flag — --log-opt max-size=1g takes its value with it — and any that has no Compose key here is named under the result, so a command never quietly loses a piece of itself.
How to use it
Paste your command, optionally change the service name (it is named after the image, so nginx:latest becomes nginx, until you type your own), then copy the generated YAML or download it straight to docker-compose.yml. The output uses the modern Compose format with no obsolete version: key, so it works with docker compose up.
Why move to Compose
A Compose file documents exactly how a container should run, keeps ports, volumes and environment variables in one reviewable place, and lets you start the stack with a single docker compose up -d instead of a long, error-prone command line.
Private by design
The conversion happens entirely in your browser with JavaScript — your command, environment variables and paths are never uploaded. That is why there is no sign-up.
Frequently asked questions
Which docker run flags are supported?
Ports (-p/--publish), volumes (-v/--volume), environment variables (-e/--env), --name, --restart, --network and -w/--workdir are mapped to their docker-compose keys, along with the image and any trailing command. The -i and -t flags become stdin_open: true and tty: true, while -d, --rm and -P only affect that one run and are dropped. Anything else the command carries — --log-opt, --sysctl, --cap-add and the rest — is read as a flag with a value, so it can never be mistaken for the image name, and the ones with no Compose key here are listed under the result rather than dropped in silence.
Does it accept both -p 8080:80 and -p=8080:80?
Yes. Short flags separated by a space or an equals sign, and the long --publish / --publish= forms, are all parsed the same way. The same applies to -v, -e and the other value flags.
What happens to -d, --rm, -i and -t?
-d (detach) and --rm (cleanup) only make sense for a one-off docker run, so they are dropped. -i (interactive) and -t (tty) describe the service, so they become stdin_open: true and tty: true. In Compose you control detaching with docker compose up -d instead.
Can I change the service name?
Yes. It is named after the image (nginx:latest becomes nginx, ghcr.io/org/my-app:1.2 becomes my-app), and app is used only when the image gives no usable name or the box is left empty. You can type any name — the generated file becomes services: <your-name>: with the mapped settings underneath.
Does the output include a version key?
No. Modern Docker Compose ignores the top-level version: field, so the generated file omits it and starts straight at services:.
Is my command uploaded anywhere?
No. The whole conversion runs locally in your browser. Your command, environment variables and volume paths never leave your device, which is why there is no sign-up.