go-supertools
Developer & Data Tools

Docker Run to Compose Converter

Convert a docker run command into a docker-compose.yml service.

Runs in your browser Your input never leaves your device.

Review the result before using it. Options Compose cannot express, and bind-mount paths, may need changes. Nothing is run or uploaded.

Report a problem with this tool

About this tool

Paste a docker run command and the tool turns it into a docker-compose.yml service. It converts the image, command and entrypoint, published ports, volumes (named volumes get a top-level volumes block), environment variables and env files, restart policy, custom networks or host networking, user, working directory, hostname, capabilities, privileged mode, labels, extra hosts, DNS, devices, memory and CPU limits, health checks and platform. Options that Compose cannot express, such as --rm, are listed as notes instead of being silently dropped. The command is only read as text and is never executed. Always review the result: bind-mount paths and secrets in environment variables need your attention before you commit the file.

How to use it

  1. Paste your docker run command, including any backslash line breaks.
  2. Optionally set the service name.
  3. Read the YAML and any notes about options that were not converted.
  4. Press Copy YAML and save it as docker-compose.yml.

Common problems

A --mount option was not converted
Only -v style volumes are converted. Translate --mount to a volumes entry in the form source:target by hand.
Compose says a network is not found
Networks used by docker run must exist. The converted file marks them external, so create them first or remove the external flag.
Secrets appear in the YAML
Environment values are copied as written. Move passwords to an env_file or Docker secrets before sharing the file.