Skip to main content

Docker Run to Compose

Convert docker run commands to a Docker Compose file, several at once with shared networks and volumes, or turn a compose file back. Private.

More options

docker run commands

Stays in your browser

compose.yaml

The result appears here after you press Convert.

Shortcuts: Ctrl+Enter run · Ctrl+Shift+C copy result · / search (use ⌘ on Mac)

Next steps

Done here? Use the Send to… menu on the result to carry it on to Docker Compose Builder or YAML ↔ JSON Converter.

Free Online Docker Run to Compose

Paste one or more docker run commands and get a compose file you can keep in your project. Flags that compose cannot express are kept as comments, never dropped silently. It gives developers a quick browser-based way to solve a focused docker run to compose task before moving the result into a project.

How to use Docker Run to Compose

Paste your docker run commands in the box on the left, or open a file, then press Convert. Put each command on its own line (a backslash at the end of a line is fine). Choose the other direction to turn a compose file back into commands.

Common mistakes

  • Putting two commands on one line: write each docker run on its own line.
  • Expecting --rm to carry over: compose keeps containers; use docker compose run --rm for one-off runs.

Frequently asked questions

Which flags are converted?
Ports, volumes and mounts, environment, env files, networks, restart policy, working directory, user, entrypoint, labels, capabilities, devices, health checks, memory and CPU limits, GPUs, hostnames, DNS, tmpfs, logging, tty and stdin. The rest are kept as comments.
What happens with several commands?
Each becomes a service. Networks and named volumes that several commands share are declared once at the top of the file.
Does compose to docker run lose anything?
Some compose features have no docker run form, such as depends_on, build and profiles. They are listed in a warning.
Is my code uploaded anywhere?
No. The conversion runs in your browser and nothing you paste is sent to a server.
How do I use this docker run to compose tool?
Use the interactive controls above; processing stays in your browser and the result is intended as a practical starting point for development work.

More DevOps & Network

View all DevOps & Network tools →