Docker Run ↔ Compose & Command Builder

Convert docker run commands into clean docker-compose.yml files or build essential Docker cleanup, log, and shell execution commands.

docker run Command Input

{{ parseError }}

Docker Cleanup & Maintenance Snippets

Clean Up Resources

docker system prune -a --volumes

Removes all stopped containers, unused networks, images, and volumes.

docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)

Stop and remove all running containers on host.

Container Shell, Logs & Inspection

docker exec -it {{ containerName || 'container-name' }} /bin/bash
docker logs -f --tail 100 {{ containerName || 'container-name' }}
docker inspect {{ containerName || 'container-name' }}
docker stats --no-stream {{ containerName || 'container-name' }}
docker cp {{ containerName || 'container-name' }}:/path/in/container ./local-path

Images

docker images
docker build -t {{ imageName || 'image:tag' }} .
docker image inspect {{ imageName || 'image:tag' }}
docker image rm {{ imageName || 'image:tag' }}

Networks

docker network ls
docker network create {{ networkName || 'network-name' }}
docker network inspect {{ networkName || 'network-name' }}
docker network connect {{ networkName || 'network-name' }} {{ containerName || 'container-name' }}

Volumes

docker volume ls
docker volume prune

Removes volumes not referenced by any container — data loss if nothing else has a copy.

Generated docker-compose.yml

{{ composeOutput }}

Recognized but not converted to YAML yet: {{ ignoredFlags.join(' ') }}. Their values (if any) were skipped correctly and won't corrupt the image or command.

docker compose config

Run this from the directory containing the saved file, before docker compose up. It parses and resolves the file exactly as Compose itself would and prints the normalized result, or the precise syntax error, without starting or building anything — the same "verify before you run it" step nginx -t/apache2ctl configtest serve for a web server config. This generator's own output is checked against a real docker compose config run as part of its test suite, not just against its own code.

About Docker Conversion

This tool parses flags like -p, -v, -e, --name, and --restart from a docker run command into standard docker-compose.yml services. The first non-flag argument is always treated as the image; anything after it (e.g. alpine echo hello) becomes the container's command:, never part of the image name.

--network becomes network_mode (verified against a real docker compose up, not just the spec text, that this correctly attaches to a custom user-defined network, not only host/none); --memory/-m, --memory-reservation, --cpus and --cpuset-cpus become mem_limit/mem_reservation/cpus/cpuset; the --health-* flags and --no-healthcheck become a healthcheck: block. Every generated file is checked against a real docker compose config run as part of this tool's own test suite.

Everything is generated locally in your browser. Nothing you paste here is saved between visits — a docker run command's -e flags often carry real secrets, so copy or download the compose file before leaving the page rather than relying on this tab to remember it.