This free docker run to compose converter turns a docker run command into a clean docker-compose.yml, or a Compose file back into the equivalent docker run command(s) 🐳. It runs entirely in your browser, handles multi-service Compose files, and flags anything it can’t translate cleanly instead of silently dropping it.
If you’ve ever inherited a wall of docker run flags from a forum post or a vendor’s install guide and had to hand-translate it into a Compose service block — or the reverse, needed a quick one-liner to spin up a single service from an existing stack — this is built for exactly that.
What This Docker Run to Compose Converter Does
- 🔁 Run → Compose: paste one or more
docker runcommands (separate multiple commands with a blank line) and get back aservices:block, correctly named and indented, ready to drop into adocker-compose.yml. - 📦 Compose → Run: paste a full Compose file with one or many services and get back one
docker runcommand per service, with flags in a sane, readable order. - ⇄ Round-trip aware: hit the swap button to flip direction and immediately feed the output back in as input — useful for sanity-checking that nothing got lost in translation.
- ⚠️ Warns instead of guessing: flags and fields with no clean equivalent on the other side —
--rm,--mount,depends_on,build:— are called out explicitly so you know what to double-check by hand.
It covers the flags people actually reach for: -p/--publish, -v/--volume, -e/--env, --env-file, --name, --network, --restart, -u/--user, -w/--workdir, --entrypoint, --label, --cap-add/--cap-drop, --dns, --add-host, --device, -m/--memory, --cpus, --health-*, --log-driver/--log-opt, and --ulimit.
How to Use It
Using this docker run to compose converter takes five steps:
- Pick a direction —
docker run → ComposeorCompose → docker run. - Paste your command or YAML into the left panel, or click Load example to see a sample first.
- Click Convert.
- Review any warnings — they point at flags or fields that need a manual decision.
- Copy the result or download it as a file 📋.
Multi-service Compose files convert into multiple docker run commands automatically, each labeled with a # service: name comment so you know which block belongs to which container — this docker run to compose converter treats each service as its own command, not a merged mess.
Why the Conversion Isn’t Always 1:1
docker run describes exactly one container at the moment it’s created. Compose describes a whole stack, with startup ordering, shared networks, and declarative state. Any docker run to compose converter that pretends these two things are always interchangeable would just be lying to you quietly. This one doesn’t — it’s built to be an honest docker run to compose converter, not an optimistic one:
depends_onhas nodocker runequivalent — you’d start dependent containers manually, in order.- A service using
build:instead ofimage:needs to be built first (docker build -t name .) before adocker runcommand can reference it. --rmhas no Compose equivalent, since Compose manages the container’s lifecycle for you.- Joining more than one Docker network at container creation isn’t possible with
docker run— extra networks get connected afterward withdocker network connect.
Every one of these shows up as a warning under the output, not a silent omission.
Practical Use Cases
People reach for a docker run to compose converter in a handful of recurring situations:
- 🐳 Adopting a project into Compose — you found a great self-hosted app with only a
docker runone-liner in its README, and you want it managed alongside the rest of your stack. - 📋 Auditing an existing Compose file — convert a service back to
docker runto see, flag by flag, exactly what will happen when it starts. - 🔁 Migrating a manually-run container — turn a container you’ve been babysitting with shell scripts into a proper Compose service with
restart: unless-stopped. - 🧪 Quick one-off testing — pull a single service out of a larger Compose stack and run it in isolation with the equivalent
docker runcommand. - 📚 Learning Compose syntax — see how flags you already know from
docker runmap onto Compose’s YAML fields.
If you work with self-hosted Docker stacks, you might also like the visual Compose editor or Portainer for managing the containers this tool helps you define.
Privacy, Ads, and Data Policy
- ✅ 100% free — no registration, no limits, no premium tier
- ✅ No data storage — your commands and Compose files never leave your browser
- ✅ No ads in results — no watermarks, no tracking pixels
- ✅ Client-side only — parsing and generation both run in JavaScript, with no external API calls
That’s the whole point of running a docker run to compose converter in the browser instead of a backend service: your Docker commands and Compose files stay on your device. Period 🔒.
Open Source and Self-Hosting
This docker run to compose converter is open source, available on GitHub. It’s a single-folder deploy: three files (index.html, style.css, script.js) plus one dependency, js-yaml (MIT license), loaded from a CDN for YAML parsing. No build step, no server-side runtime.
Browse the rest of the free utilities — including more homelab and Docker tools — on the Tools page, or fork this docker run to compose converter to add the flags you need.
If docker run flags still feel unfamiliar, start with Docker for Beginners: Containers, Images, Volumes, and Compose. Once your Compose file is in good shape, Docker Hardened Images for Self-Hosting is worth a read for pinning image tags properly.
Built by VahaC — 100% client-side, no data sent anywhere.
