Paste a docker run command and get a docker-compose.yml service block instantly.
| Flag | Compose key | Example |
|---|---|---|
| --name | container_name | --name myapp |
| -p / --publish | ports | -p 8080:80 |
| -e / --env | environment | -e NODE_ENV=prod |
| -v / --volume | volumes | -v /host:/container |
| --network | networks | --network appnet |
| --restart | restart | --restart unless-stopped |
| --entrypoint | entrypoint | --entrypoint "/bin/sh" |
| -m / --memory | mem_limit | -m 512m |
| --cpus | cpus | --cpus 1.5 |
| -u / --user | user | -u 1000:1000 |
| -w / --workdir | working_dir | -w /app |
| -l / --label | labels | -l app=myapp |
Generated YAML follows the Compose Specification (used by Docker Compose V2+). The legacy version: key is intentionally omitted β it is deprecated and no longer required by modern Docker Desktop and Docker Engine.
docker run commands become hard to manage once they include multiple flags for ports, volumes, environment variables, and networks. A docker-compose.yml is version-controlled, readable, and supports multi-service orchestration with a single 'docker compose up' command.
The converter supports the most common flags: -d/--detach, --name, -p/--publish, -e/--env/--env-file, -v/--volume, --network, --restart, --memory/-m, --cpus, --user, --workdir/-w, --entrypoint, --label/-l, and multi-word commands via CMD. Image and tag are always extracted.
Usually for simple services the generated YAML works as-is. For complex setups you may want to add depends_on, healthcheck, build context, or secrets. The generator creates a minimal, correct starting point that you can extend.
The converter generates modern Compose format without a version: key, following the Compose Specification (used by Docker Compose V2 and later). The version key is deprecated in the latest specification.