About Docker Run to Docker Compose Converter
This tool converts a docker run command into a docker-compose.yml snippet, making one-off container commands easier to migrate into maintainable Compose workflows.
Key Features
- Parses common
docker runoptions and outputs Compose YAML. - Separates options that cannot be mapped directly for manual review.
- Lists options that are not implemented for auto conversion yet.
- Reports command format issues with clear error items.
- Supports one-click copy and
docker-compose.ymldownload.
Supported Options
Current support includes: --name, -p/--publish, -v/--volume, -e/--env, --env-file, --restart, --network, --entrypoint, --cpus, --memory/-m, --memory-reservation, --memory-swap, -w/--workdir, -u/--user, -h/--hostname, --add-host, --dns, --dns-search, --dns-option, --label, --log-driver, --log-opt, --device, --cap-add, --cap-drop, --security-opt, --tmpfs, --health-cmd, --health-interval, --health-timeout, --health-start-period, --health-retries, --platform, and boolean flags --privileged, --read-only, -i/--interactive, -t/--tty, --init.
Conversion Rules
- Output defaults to Compose
version: "3.9". - Service name prefers
--name; otherwise it is inferred from image name. - Trailing command arguments are mapped to the
commandarray. -d/--detachand--rmare reported as non-direct mappings.--mount,--pull, and--gpusare currently marked as not implemented.
Steps
- Paste a one-line or multiline
docker runcommand. - Click Convert Now or edit input for live conversion.
- Review YAML output and hint blocks for manual completion.
- Copy result or download
docker-compose.yml.
Use Cases
- Migrate local container startup commands into Compose projects.
- Normalize legacy
docker runscripts before delivery. - Review container configs before deployment handoff.
Privacy
All parsing and YAML generation run locally in your browser without uploading command content.