docker run to Docker Compose
Paste a docker run command and get the equivalent compose.yaml service: ports, volumes, environment, restart policy, healthcheck, networks and more.
Free · No sign-up · Your inputs stay in your browser
Input
Convert docker run to Docker Compose
Output
compose.yaml
395 characters
Written for the Compose Specification, so there is no version: key (Compose v2 ignores it and warns). Named volumes are declared at the bottom; networks given with --network are assumed to exist already and marked external. Start it with docker compose up -d.
Runs in this browser. Nothing you paste is sent to a server.
About this tool
Method, assumptions, practical next steps, and limits.
Why move to Compose
A long docker run line lives in shell history or a README and drifts. A compose.yaml is versioned with the project, starts the whole stack with docker compose up -d and recreates only what changed. The file format is the Compose Specification; the top-level version: key is obsolete and ignored.
Things to check
Compose prefixes names with the project, so a named volume called redis-data becomes myproject_redis-data, a different volume from the one docker run created. Declare it external: true to reuse existing data. Shell substitutions such as $(pwd) are not evaluated in Compose files; use a relative path like ./ instead.