Skip to main content
DevOps Tools

Docker Run to Docker Compose Converter

Paste a docker run command and convert its supported flags into a docker-compose.yml service definition.

Paste a docker run command below - this tool parses its common flags and generates the equivalent docker-compose.yml service definition.

Any flags this tool doesn't recognize are listed separately, so nothing is silently dropped without you knowing.

Why Convert docker run to Compose?

A long docker run command with many flags is hard to read, version-control, and reuse - a docker-compose.yml service definition captures the same configuration in a structured, shareable file.

How to Use It

  1. Paste your full docker run command.
  2. Click Convert.
  3. Review the generated service definition, plus a list of any flags this tool didn't recognize.

Understanding the Result

Supported flags map directly to their Compose equivalents: --name becomes the service key, -p/--publish becomes ports, -v/--volume becomes volumes, -e/--env becomes environment, and --restart, --network, and --hostname map to their like-named Compose keys.

Limitations

Highly complex or unusual docker run invocations (uncommon flags, shell expansion, multi-line commands with unusual escaping) may not parse perfectly - review the generated YAML before relying on it.

Share this tool: