Docker Run to Compose Converter — Free
Runs 100% in your browser — your files never leave your device.
A working docker run command is useful for testing but hard to maintain or share. Paste it to generate equivalent Compose YAML with the image, command, ports, volumes, environment variables, restart behavior, and other supported options arranged under a service.
How it works
- 1
Paste a docker run command
- 2
Review conversion messages
- 3
Copy the Compose YAML
About this tool
What the conversion covers
The tool translates docker run flags into Compose service YAML: images, published ports, volumes, environment variables, restart policies, and command overrides. The output drops into docker-compose.yml under a services key and behaves like the equivalent run command.
Why Compose wins for anything repeated
A run command lives in someone's shell history; a compose file lives in the repository. Volumes, networks, and environment files become reviewable, versioned configuration — and docker compose up replaces a 200-character command nobody remembers.
Check the translated file
Conversion covers the standard flags; exotic options (devices, capabilities, custom networks) may need hand-tuning. After converting, run docker compose config to validate the YAML, and compare docker compose ps against the run container you were emulating.
Frequently asked questions
Which flags translate automatically?
The core set: -p name, -p ports, -v volumes, -e environment, --restart, --name, and the image plus command. Anything unusual appears as a comment to finish by hand.
Where do I put the converted service?
Under the services key in docker-compose.yml, named whatever you want to call the service. Multiple converted services compose side by side.
Does the converted file behave identically to the run command?
For the translated flags, yes. Compose adds its own project network and naming conventions — behavior matches, resource names differ.