Docker Run to Compose Converter

Convert a docker run command into a docker compose.yaml service with ports, volumes and environment.

Runs instantly in your browser — results update as you type.

How do I convert docker run to docker compose?

Paste your docker run command and the tool maps each option to its compose key — -p to ports, -v to volumes, -e to environment, --restart to restart, --name to container_name — and writes a compose.yaml you can start with docker compose up -d.

Mapping

docker runcompose.yaml
-p 8080:80ports: ["8080:80"]
-v data:/var/libvolumes: + top-level named volume
-e KEY=valueenvironment:
--restart unless-stoppedrestart: unless-stopped
--network mynetnetworks: (external)

Options without a direct equivalent are listed as warnings.

Frequently asked questions

Is the file called docker-compose.yml or compose.yaml?

Both work; compose.yaml is the current recommended name.

Do I need the version: key?

No, it is obsolete in Docker Compose v2.

Is anything sent to a server?

No, conversion runs in your browser.