Overview
Converts in both directions: paste a docker run command and read back a docker-compose.yml, or paste compose YAML and read back the equivalent docker run invocation. Everything runs locally and updates live as you type.
How It Works
Choose the direction with the toggle at the top, paste into the left pane, and the result appears on the right. The run-to-compose parser understands backslash line continuations, quoted arguments, clustered short flags such as -it, --flag=value forms, and dozens of flags — --name, -p/--publish, -v/--volume, -e/--env, --env-file, --restart, --net/--network, -m/--memory, --user, --workdir, --entrypoint, --label, --cap-add, --dns and more. The reverse direction parses the compose YAML, including map-style environment blocks, and rebuilds one docker run command per service from image, container_name, restart, ports, environment, env_file, volumes, networks, command, entrypoint and the other keys it knows. Warnings appear below the output, and each direction has a download button (docker-compose.yml or docker-run.sh).
Step-by-Step Usage Guide
- Switch to the direction you need — the toggle swaps both panes.
- Paste the docker run command or the compose service definition.
- Read the generated YAML or command line, check the amber warnings list for anything the converter could not express, and adjust it.
- Copy it into your repository or terminal.
Technical Specifications & Standards
Forward conversion tokenizes the command with a quote-aware scanner that respects single and double quotes, maps each recognised flag onto a Compose key, and emits YAML with port mappings quoted so the colons cannot confuse a YAML parser. A --network flag also generates the top-level networks block marked external: true. The reverse direction runs the input through a small structural YAML parser (block mappings, lists, flow lists and block scalars) rather than a line reader: it requires a services: mapping, rejects tab indentation, converts the keys it knows, and lists a warning for the ones it does not, such as depends_on, healthcheck, build and secrets.
Targeted Use Cases
- Turning the docker run one-liner from a README or Docker Hub page into a compose file you can commit.
- Extracting a single service from a compose stack as a one-off docker run while debugging.
- Documenting how a container is actually configured, in whichever format the team reads.
- Moving between a laptop workflow (compose) and a single-host deployment (plain run).
Notes & Gotchas
- Flags with no Compose equivalent, such as --rm, --mount, --ulimit, --log-driver and the --health-* options, are not converted silently: each one raises a warning below the output. Add them to the YAML by hand.
- -m/--memory becomes mem_limit, and -d has no compose equivalent — docker compose up detaches by default, so it is intentionally omitted (the reverse direction always adds -d).
- On the compose side, map-style environment (KEY: value), env_file, command, entrypoint and deploy memory and CPU limits convert, while depends_on, healthcheck, build, secrets and other unknown keys are skipped with a warning.
- Values are quoted automatically when plain YAML would be ambiguous (a colon followed by a space, a leading special character, true or false, numbers) and ports are always quoted; still review the output before committing it.
Frequently Asked Questions
Does it support --env-file?
Yes. --env-file becomes an env_file entry in Compose, and env_file converts back to --env-file.
Is the generated YAML valid for docker compose up?
For typical commands, yes — port mappings are quoted and the service name is derived from --name. Treat unusual environment values as a reminder to review the output, not as a guarantee.
Which compose keys become run flags?
Most service keys: image, container_name (--name), restart, hostname, user, working_dir, entrypoint, command, ports, expose, environment, env_file, volumes, tmpfs, labels, networks or network_mode, capabilities, DNS, devices, privileged, tty, stdin_open, and mem_limit and cpus (also under deploy.resources.limits). Keys it does not convert raise a warning.
Why does my input need to start with docker run?
The forward parser accepts docker run, docker create or docker container run and rejects anything else, so it never guesses at half-recognised input. Unrecognised flags inside a valid command raise a warning instead of being dropped.