docker run to Compose Converter

Handles quoted values, backslash line continuations and --flag=value form. Named volumes and networks referenced by the command are declared at the top level.

docker run to Compose Converter — Free Online Tool

Converts a docker run command line into a docker-compose.yml service definition, mapping -p, -v, -e, --name, --network, --restart, --link, -w, -u, --entrypoint, --cap-add and --health flags onto their Compose keys, handling repeated flags, combined short flags and quoted values, and keeping the trailing image and command arguments.

How to use the docker run to Compose Converter

  • Open the tool above — it runs entirely in your browser, so your input never leaves this page.
  • Paste or type your input into the field, then press the relevant button (e.g. Encode / Decode, Generate, or Convert).
  • Copy the result from the output area with the copy button orCtrl/Cmd + C.
  • No signup, no upload, and no tracking — repeat as often as you need.

Frequently asked questions

Which docker run flags are supported?

The ones with a Compose equivalent: -p, -v, -e, --name, --network, --restart, -w, -u, --entrypoint, --cap-add/drop, --label, --health-*, --memory, --cpus, --device, --add-host and more. Runtime-only flags such as -d, -it and --rm have no Compose key and are dropped.

Why are volumes and networks also declared at the bottom?

Compose requires a top-level declaration for any named volume or network a service references. A bind mount (a path starting with . or /) needs no declaration, so only genuine named volumes are listed.

Is the generated file ready to run?

Usually yes with docker compose up. Check two things: networks are declared external: true on the assumption they already exist, and mem_limit and cpus apply under Compose v2 but are ignored by Swarm, which wants a deploy.resources block instead.

Free & private — why use this docker run to Compose Converter

The docker run to Compose Converter runs 100% client-side in your browser. Your data is never uploaded to a server, no account is required, and the tool is completely free. It works offline once the page has loaded and is part of a growing collection of privacy-first developer utilities.

More devops & date/time tools