Skip to content
Utilerio

docker run to Compose

Paste a docker run command and get the equivalent docker-compose.yml service.

Was this tool useful?

About this tool

A `docker run` command with a dozen flags is hard to version, review or hand to a teammate — a Compose service definition is all three. This reads the flags and produces the equivalent service, never executing the command itself.

How to use it

  1. Paste a `docker run ...` command.
  2. Press Convert to get an equivalent docker-compose.yml service definition.
  3. Flags with no direct Compose equivalent (like --rm) are listed as a caveat rather than silently dropped.

Examples

A web server with a port and a volume

docker run -d --name web -p 8080:80 -v ./data:/app/data nginx:latest
A `services.web` block with image, container_name, ports and volumes set accordingly.

Common problems

My command uses a flag that isn't in the output at all.
An unrecognised flag is listed under the caveats rather than silently ignored — check that list; anything not mentioned there but still missing from the YAML is worth double-checking by hand.

Frequently asked questions