Docker Run → Compose
Convert a docker run command to the equivalent docker-compose.yml automatically. Maps ports, volumes, environment variables, networks and restart policies.
Flags suportadas
--name → container_name
-p / --publish → ports
-v / --volume → volumes
-e / --env → environment
--network → networks
--restart → restart
--entrypoint → entrypoint
-u / --user → user
-w / --workdir → working_dir
-l / --label → labels
--hostname → hostname
--memory / -m → mem_limit
From a one-off command to versioned Compose
That container you started with a five-line docker run works fine, but the command lives in your shell history and nobody else can reproduce it. Paste the command here and get the equivalent docker-compose.yml: ports, volumes, environment variables, restart policy, network, user and memory limit, each mapped to the right key, ready to be committed next to the project it belongs to.
The converter understands quotes and backslash line continuations, accepts both -p 8080:80 and --publish=8080:80, and drops -d and --rm on purpose: in Compose, detaching is decided at docker compose up -d time. Named volumes get a volumes: section at the end of the file, networks other than bridge, host or none get a networks: section, and the YAML comes out without the version: line, which Compose v2 treats as obsolete.
Review before you use it: flags outside the supported list, such as --cap-add, --device or --gpus, are silently ignored, so if your command depends on them, add them to the YAML by hand. Running docker compose config validates the result. The conversion runs entirely in your browser, which matters here: docker run commands often carry database passwords in -e flags, and none of that is sent to any server.
Frequently asked questions
Why is -d missing from the generated file?
Are all docker run flags supported?
Do I need to add a version line to the file?
Related Tools
Dockerfile Generator
Build a Dockerfile from common templates: Node, Python, Go, Static Nginx, with optional multi-stage, healthcheck and non-root user. Everything in your browser.
docker-compose MongoDB Generator
Generates a ready-to-use docker-compose for MongoDB, with root user and password, port 27017 published and a persistent volume. You create the database after it starts.
docker-compose MySQL Generator
Generates a ready-to-use docker-compose for MySQL, with the root password, port 3306 published and a persistent volume. Pick the image tag and start the database.