Support

Convert

Runs in your browser· your command or file is converted in this tab and never uploaded

Convert docker run to Docker Compose, and back

Move a container you started by hand into a docker-compose.yml, or turn a Compose service into a docker run command you can paste into a terminal. The converter reads quoted values and line continuations, declares named volumes and networks, and tells you which options it could not map instead of dropping them silently. It runs in your browser.

Frequently Asked Questions

How do I convert a docker run command to docker-compose.yml?
Paste the command (multi-line commands with backslashes are fine). The page reads the flags and writes a Compose service: -p becomes ports, -v becomes volumes (named volumes are also declared at the top level), -e becomes environment, --restart becomes restart, and so on. Copy the YAML or download docker-compose.yml.
Which docker run flags are supported?
The ones most commands use: name, ports, volumes and mounts, environment and env files, labels, restart, working dir, user, hostname, entrypoint and command, networks and host mode, capabilities, devices, DNS, extra hosts, memory and CPU limits, health checks, logging, privileged, read-only, init, and interactive and tty. A flag the page does not map, such as --rm or --gpus, is listed under the result so you know to handle it by hand.
Can I convert Compose back to docker run?
Yes. Switch to "Compose to docker run" and paste the file. Each service with an image becomes one docker run command. Keys with no docker run equivalent, such as depends_on, build or deploy, are listed. Because docker run does not create the Compose network, use docker compose up when services must find each other by name.
Is my command uploaded anywhere?
No. The conversion runs in your browser tab and nothing is sent to a server or stored. Still, a docker run command often holds passwords in -e values: check what you paste, and prefer an env file for secrets.

Found this useful? Hexabench is free and ad-free. If it saved you time, you can support it.

Buy me a coffee →