About the Docker Run to Compose tool
A long docker run command with a dozen flags works, but it is hard to read, easy to mistype and impossible to version properly. Docker Compose describes the same container in a YAML file you can commit, review and start with one command. This converter reads your docker run commands and writes the equivalent compose.yaml.
The parser understands shell quoting and line continuations (backslash, PowerShell backtick or cmd caret), combined short flags like -dit, and both --flag value and --flag=value forms. Ports, volumes and --mount, environment variables and env files, restart policy, container name, networks, labels, entrypoint, command, working directory, user, hostname, extra hosts, DNS, capabilities, devices, memory and CPU limits, ulimits, sysctls, logging, healthchecks and GPU requests are all mapped. Named volumes and custom networks are declared at the top level, with networks marked external.
Paste several commands to get one service per container. Flags without a Compose equivalent, such as --rm, are listed so nothing is silently lost. The conversion runs in your browser, so passwords in environment variables stay on your machine.
How to use Docker Run to Compose
- Paste one or more docker run commands into the input, or click “Load sample”.
- Read the generated compose.yaml in the output pane.
- Check the “Review these before running” box for skipped or partially mapped flags.
- Click “Download” to save compose.yaml or “Copy” to paste it.
- Start the stack in that folder with docker compose up -d.
Features
Real shell parsing
Handles quotes, escapes, line continuations and multiple commands.
Over 50 flags mapped
From ports and volumes to healthchecks, ulimits, logging and GPUs.
Top-level volumes and networks
Named volumes and user-defined networks are declared automatically.
Safe YAML quoting
Values like 5432:5432 and yes/no are quoted so YAML does not misread them.
Nothing silently dropped
Unsupported flags are listed with a note instead of being ignored.
When to use it
- Turn the docker run line from a project README into a compose file.
- Convert containers started by hand on a server into a reproducible setup.
- Combine a database, cache and app container into one stack.
- Move from shell scripts to Compose for a home-lab or self-hosted service.
- Document how a container is configured for teammates.
Frequently asked questions
Does the output include a version key?
No. The current Compose Specification no longer needs version:, and Docker Compose v2 ignores it.
Why are my networks marked external?
A network passed with --network must already exist when using docker run, so it is declared external. Remove external: true if you want Compose to create it.
What happens to -d, -it and --rm?
-d is the default for docker compose up -d. -i and -t become stdin_open and tty. --rm has no equivalent and is listed in the notes.
Can it convert docker-compose back to docker run?
No, this tool only converts docker run commands into Compose YAML.
Are my environment variables sent anywhere?
No. The command is parsed in your browser and never uploaded.