RootUtils

Docker Converter

Client-Side Secure

Free online Docker Converter. Convert docker run commands to docker-compose.yml files.

Run to Compose

Convert CLI commands to YAML

Input (Bash)
Output (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 FlagCompose PropertyDescription
-p 80:80ports: ["80:80"]Maps a container port to the host machine.
-v /data:/appvolumes: ["/data:/app"]Mounts a directory or volume.
-e DEBUG=trueenvironment: [DEBUG=true]Sets environment variables inside the container.
--restart alwaysrestart: alwaysConfigures the container restart policy on crash/reboot.
--name webcontainer_name: webAssigns 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.