docker run to Compose
Turn a long `docker run` command into an equivalent docker-compose.yml service.
Results are provided as is, for general information. Check anything important before relying on it. See the Terms of Use.
About this tool
A README often gives you a long `docker run` one-liner; a project usually wants that as a service in docker-compose.yml. This tool does the translation. It tokenizes the command the way a shell would — respecting quotes and backslash-newline continuations — strips the leading docker run, and maps the flags it recognizes: -p, -v, -e, --name, --restart, --network, -w, -u, --hostname, resource limits, --privileged and more, plus the trailing image and command. Flags it does not map are listed underneath rather than silently dropped, so you always know what still needs a manual line. The output is a single-service compose file; parsing runs entirely in your browser.
When to use it
Questions
Does it produce a complete, final compose file?
It produces a correct starting point for one service. Named volumes and networks, depends_on, healthcheck details, build context and multi-service wiring are yours to add. Anything the tool could not map is listed so you know what is missing.
How does it pick the service name?
The --name value if you passed one, otherwise the image's final path segment with the tag stripped — ghcr.io/acme/api:latest becomes api. Rename it freely; the name is just the key under services:.
What does 'Not mapped' mean?
The command used a flag the tool does not translate to a Compose key — something like --sysctl, --add-host or --gpus. Its value was consumed so it did not get mistaken for the image, but you will need to add the equivalent Compose setting by hand. Look it up in the Compose file reference.
Are -d, -it and --rm reflected?
No, and that is intentional. --detach, --interactive, --tty and --rm describe how you invoke the container from the CLI, not how the service is defined. Compose handles detach and lifecycle itself.
Which Compose version does the output target?
It emits the modern schema: a top-level services: map with no version: key, which is what current Docker Compose expects.