Skip to content
ohsudo, Home

docker run ⇄ Compose Converter

Turn docker run commands into a compose.yaml, or a compose file into docker run commands, in the right order, listing anything that does not translate.

● Runs 100% in your browser — nothing you type leaves this page.

Result
The result appears here.

How to use it

  1. Pick a direction: docker run → Compose or Compose → docker run.
  2. Paste your commands or your compose.yaml on the left. Several docker run commands become several services; \ line continuations, sudo, and docker network create / docker volume create lines are understood.
  3. Copy the result. Read the Check these box under it: it lists every option that has no exact equivalent on the other side, so nothing is lost silently.

Nothing is uploaded: the conversion runs in your browser, so passwords in environment variables stay on your machine.

docker run → Compose

Compose → docker run

The result is a shell script you can run as it is:

FAQ

Why convert at all?

docker run commands get long and end up in shell history, or a wiki. A compose file keeps the same setup in one place, under version control, started with docker compose up -d. The other way round helps on a host without Compose, or to see exactly what Compose does.

Is the result identical to what Compose does?

Very close, not identical. Compose adds its own labels to containers and networks, and handles restarts of the whole stack. The script starts the same containers, with the same options, names and networks.

My file says “is not a docker command” or “Additional property is not allowed”

The first is a missing Compose plugin: see 'compose' is not a docker command. The second is a key Compose doesn’t know at that place: see Additional property is not allowed. Check a converted file with docker compose config.

The containers can’t reach each other

Each one must be on the same network and use the other’s service name, not localhost. See connecting to localhost from a container. If a name or port is already taken by an old container, see container name is already in use and port is already allocated.

Can I start from a template instead?

Yes: the Docker Compose Generator builds a compose file from common services. The Docker Compose cheat sheet has the everyday commands.

Should every service publish its port?

No. Containers in the same project reach each other by service name without ports:, and published ports skip UFW. Publish only what must be reached from outside, on 127.0.0.1 when it’s only for the host. See Docker ports bypass UFW.

Articles

Learn more