Docker run to Docker Compose converter

Paste one or more docker run commands and get a Compose file. It runs in your browser, so nothing you paste leaves the page.

compose.yaml


How the conversion works

The command is split the way a shell would split it: quotes, backslash line continuations and several commands, one per line. Every option is then matched to its Compose key, with the image first, and the result is written out as YAML. Named volumes become top-level volumes, and a volume path that starts with /, . or ~ stays a bind mount. The output has no version: key, because the Compose Specification no longer uses one.

These are the options it converts. Anything else is listed under the output instead of being dropped, so you can check it by hand.

docker runCompose key
-p, --publishports
--exposeexpose
-v, --volume, --mountvolumes, tmpfs, top-level volumes
-e, --env, --env-fileenvironment, env_file
--restartrestart
--network, --network-aliasnetwork_mode, networks
--name, -h, -u, -w, --entrypointcontainer_name, hostname, user, working_dir, entrypoint
--cap-add, --cap-drop, --privileged, --devicecap_add, cap_drop, privileged, devices
--health-*, --no-healthcheckhealthcheck
-m, --cpus, --shm-size, --ulimitmem_limit, cpus, shm_size, ulimits
-l, --label, --add-host, --dnslabels, extra_hosts, dns
--log-driver, --log-opt, --gpuslogging, deploy.resources.reservations.devices
--rm, -PListed, not converted

It is a translation of flags, not a check of your setup: it does not start anything, and it does not know whether an image or a network exists. Run docker compose config on the result before you rely on it. The flags are those of the docker run reference.

Frequently asked questions

Does it send my command anywhere?

No. The conversion is plain JavaScript on this page. Nothing you paste is uploaded, stored or logged; the page only counts a visit and whether the converter was used.

Why is there no version key in the output?

The Compose Specification made the top-level version key obsolete, and current Docker Compose ignores it and prints a warning if it is there. The file starts with services instead.

What does it do with flags Compose cannot express?

It lists each one under the output instead of dropping it silently. --rm and -P have no Compose equivalent, and flags it does not know are named so you can check them by hand.

Why are named networks marked external?

In docker run a network named with --network must already exist, so the converter writes it as external: true. Delete that line if you want Compose to create the network for you.

Does it handle several commands at once?

Yes. Put each docker run on its own line, or join lines with a trailing backslash, and every command becomes a service in one file. Duplicate names get a number.

Then deploy the file

Tugport is a free, open-source deploy platform in one Rust binary. It deploys a Compose file like this one to your own server on every push, with zero-downtime rollouts and HTTPS. See Tugport on GitHub or read how it moves a server over.