Back to all tools

Docker Run → Compose Converter

Paste a docker run command and get a ready-to-use docker-compose.yml. Supports ports, volumes, env vars, networks, and more.

Why convert docker run to docker-compose?

Docker Compose makes it easy to define, configure, and run multi-container Docker applications. While docker run commands work fine for quick tests, Compose files are easier to maintain, version-control, and share. You can run your entire stack with a single docker compose up command.

This tool parses your existing docker run command and converts it to a well-formatted docker-compose.yml — saving you from having to manually translate each flag.

How to Use

  1. Paste your command — Paste the full docker run command, including all flags.
  2. Review the output — The YAML is generated instantly and updates as you type.
  3. Check warnings — Unrecognized flags are listed so you can handle them manually.
  4. Copy and use — Copy the YAML and save it as docker-compose.yml in your project.

Common Use Cases

Frequently Asked Questions

Does the converter support all docker run flags?

The tool supports the most commonly used flags: -p (ports), -v (volumes), -e (environment variables), --env-file, --name, --network, --restart, --cpus, --memory, and -d. Unrecognized flags are shown in a warning so you can handle them manually.

What version of docker-compose format is generated?

The output uses version "3.8" which is widely supported. If you need resource limits (--cpus, --memory), they are placed in the deploy.resources block which requires Compose v3 with Docker Swarm mode, or Docker Compose v2+ with --compatibility flag.

Can I convert multiple docker run commands?

Currently the tool converts one command at a time. For multi-container setups, convert each command separately and combine the resulting services into a single docker-compose.yml file manually.