Docker Run to Compose
Convert single Docker run commands into clean, readable Docker Compose YAML configuration files.
All parsing happens locally in your browser. Your commands are never sent to any server.
Migrating from docker run to docker-compose.yml is one of the first steps toward reproducible, version-controlled infrastructure. Our Docker Run to Compose converter parses your existing
CLI commands and generates clean, properly structured YAML — no more manual translation of every
flag.
Supported Flags
- Port Mapping
-p/--publish→ ports list - Volumes
-v/--volume→ volumes list with named volume detection - Environment
-e/--env→ environment variables - Networks
--network→ networks with optional aliases - Restart Policy
--restart→ restart policy (always, unless-stopped, on-failure) - Resource Limits
--cpus,-m/--memory,--pids-limit - Healthcheck
--health-cmd,--health-interval,--health-retries,--health-timeout - Logging
--log-driverand--log-opt→ logging configuration
How to Use the Converter
- Paste your docker run command — Enter any valid
docker runcommand into the left panel. - Review the generated YAML — The right panel
instantly shows the equivalent
docker-compose.ymlconfiguration. - Copy or download — Use the Copy button or download the YAML file for direct use in your project.
Example Conversion
Input
docker run -d \ --name my-app \ -p 3000:3000 \ -v ./data:/app/data \ -e DB_HOST=localhost \ -e DB_PORT=5432 \ --restart always \ my-app:latest
Output
services:
my-app:
image: my-app:latest
ports:
- "3000:3000"
volumes:
- ./data:/app/data
environment:
- DB_HOST=localhost
- DB_PORT=5432
restart: alwaysKey Features
- Smart Parsing
Handles quoted strings, escaped characters, and complex flag combinations.
- Named Volume Detection
Automatically detects named volumes and adds them to the top-level volumes section.
- Network Generation
Generates network definitions with bridge driver and alias support.
- Clean YAML Output
Properly indented, production-ready Docker Compose format.
- One-Click Copy
Copy the generated YAML to your clipboard instantly.
- 100% Private
All parsing is done client-side. No data is uploaded anywhere.
Frequently Asked Questions
What Docker flags are supported?
Does it support multi-line commands?
How are named volumes handled?
/, ./, or ~ are treated as named volumes and added to the top-level volumes: section with a local
driver.Can I convert commands with subcommands or exec?
docker run commands. Commands like docker exec, docker build, or docker compose are not supported.