๐ Runs in your browser โ nothing is uploadedโ Free, no signup
Docker Run to Docker Compose
Paste one or more docker run commands to get an equivalent docker-compose.yml โ ports, volumes, environment variables, networks and restart policies included.
0 characters
docker-compose.yml
When should you use the Docker Run to Compose?
- Turning a docker run command from a README into a Compose file
- Combining several containers into one docker-compose.yml
- Making container setups easier to version and share
How to use the Docker Run to Compose
- 1
Paste commands
Paste one or more docker run commands. Line continuations (\) are fine.
- 2
Check the YAML
Each command becomes a service. Named volumes and networks are declared at the bottom.
- 3
Review notes
Any option that couldn't be converted is listed under the output.
- 4
Save it
Download docker-compose.yml and run docker compose up -d.
Examples
nginx with a port and volume
docker run
docker run -d --name web -p 8080:80 -v ./html:/usr/share/nginx/html --restart always nginx
docker-compose.yml
services:
web:
image: nginx
container_name: web
restart: always
ports:
- "8080:80"
volumes:
- ./html:/usr/share/nginx/htmlCommon errors and how to fix them
Paste a command that starts with docker run- Remove anything before docker, such as a $ prompt. sudo docker run is fine.
A network is marked external- Networks created with docker network create are external to Compose. Remove external: true if you want Compose to create it.
More from Code Formatters & Minifiers
Free tools that run in your browser โ no signup, nothing uploaded.
SQL Formatter & Beautifier
Format SQL queries for MySQL, PostgreSQL, SQL Server, SQLite and more.
CSS Minifier & Compressor
Optimize CSS by removing whitespace and comments to accelerate page load time.
JS Minifier & Compressor
Compress JavaScript to improve website speed and performance.
XML Formatter & Validator
Format, validate and minify XML, with errors shown by line and column.
HTML Formatter & Beautifier
Beautify or minify HTML with clean, consistent indentation.
Markdown Editor & Preview
Write Markdown with a live preview and copy the HTML.
HTML to JSX Converter
Convert HTML to valid React JSX โ className, style objects and more.
SVG to React Component
Turn SVG markup into a React component with camelCase attributes.
HTML to Markdown Converter
Convert HTML to clean Markdown, including tables and code blocks.
Docker Run to Compose FAQ
Ports (-p), volumes (-v, --mount), environment (-e, --env-file), --name, --restart, --network, -w, -u, --entrypoint, labels, healthchecks, logging, capabilities, devices, ulimits, --gpus, -it and more. Unsupported options are listed under the output.
No. Modern Docker Compose ignores it. Tick the option only if you use an older docker-compose that needs version: "3.8".
Yes โ paste multiple commands, one per line or joined with &&. Each becomes its own service in the same file.
They're dropped: Compose runs services detached with docker compose up -d, and manages container removal itself.
A volume like pgdata:/var/lib/postgresql/data is added to the service and declared in a top-level volumes section.
No. Everything runs in your browser, so your commands never leaves your device.
