← All tools

Docker Run to Compose Converter

Convert docker run commands to docker-compose.yml and back. Named-volume detection, shell tokenizing, and full round-trips — all local.

This tool runs entirely in your browser. Your input is never uploaded.

Direction
nginx:alpine · 1 port(s) · 2 volume(s)
docker run command
docker-compose.yml

From docker run to compose and back

Paste a docker run command and get an equivalent docker-compose.yml; paste a compose file and get the matching docker run command. Round-trips are lossless: converting a generated compose file back yields the same YAML. Shell tokenizing handles quotes, backslash line continuations, and $'...' quoting, so multi-line commands with quoted values parse correctly.

What gets recognized

Ports (-p), volumes (-v/--mount) with named-volume detection (bind mounts stay inline; named volumes get a top-level volumes: declaration), environment variables as a map (${VAR} values preserved), env files, labels, container_name, restart policy, networks with top-level declarations, user, working dir, hostname, memory and CPU limits, health checks, devices, capability flags, and the boolean trio -d/-it/--rm (mapped to compose semantics with a note for --rm). Unknown or exotic flags are never silently dropped — they appear in a warning line above the output.

Output

The header strip summarizes the parse (image, port count, volume count). Output is live; Use as input keeps editing, and Copy/Download follow the usual result actions (docker-compose.yml or run.sh).

Parsing happens entirely in your browser — nothing is sent anywhere.

Related tools

A growing collection of browser-only tools. Your data stays on your device whenever the browser can handle the task.