Docker Converter
Client-Side SecureFree online Docker Converter. Convert docker run commands to docker-compose.yml files.
Run to Compose
Convert CLI commands to YAML
Is this tool broken?
Let us know if you found a bug or have a feature request.
The Ultimate Docker Run <> Compose Converter
Instantly convert messy docker run commands into clean, reproducibledocker-compose.yml files—and back again.
Stop manually translating flags like -p, -v, and -e. Our bi-directional converter handles complex configurations, multi-line commands, and even validates your YAML syntax in real-time.
Docker Compose Best Practices
Use Named Volumes
Avoid host paths (e.g., /var/lib/mysql) when possible. Named volumes are managed by Docker and are easier to back up and migrate.
Define Networks
Don't rely on the default bridge network. Create custom networks for service isolation (e.g., `frontend-net`, `backend-net`).
Version Control
Commit your docker-compose.yml to Git. It serves as "Infrastructure as Code," documenting exactly how your application is deployed.
Environment Variables
Use an .env file for secrets (passwords, API keys). Never hardcode sensitive data directly into your Compose file.
Common Docker Flags Mapped
| Docker Run Flag | Compose Property | Description |
|---|---|---|
| -p 80:80 | ports: ["80:80"] | Maps a container port to the host machine. |
| -v /data:/app | volumes: ["/data:/app"] | Mounts a directory or volume. |
| -e DEBUG=true | environment: [DEBUG=true] | Sets environment variables inside the container. |
| --restart always | restart: always | Configures the container restart policy on crash/reboot. |
| --name web | container_name: web | Assigns a custom name to the container. |
Frequently Asked Questions
Can I convert multiple containers?
Yes! If you are converting Compose to Run, the tool will generate a list of separate docker run commands for each service defined in your YAML file.
What version of Compose is supported?
We generate YAML compatible with Docker Compose v3.x, which is the standard for modern deployments. It works with both docker-compose and the newer docker compose CLI plugin.
You might also like
Free online JSON to YAML Converter. Transform JSON data to YAML and back instantly. Validates syntax and errors. Simple, fast, and secure.
Free online Diff Checker. Compare text, code, or JSON files side-by-side to find differences. Highlight changes.
Free online JSON to TypeScript Converter. Automatically generate TypeScript interfaces from your JSON objects. Save time and reduce errors.