PureDevTools

Docker Run to Compose Converter

Convert docker run commands to docker-compose.yml — parses all flags, nothing sent to any server

All processing happens in your browser. No data is sent to any server.
Docker Run Command(s)
docker-compose.yml
Supported Flags Reference
--name-p / --publish-v / --volume-e / --env--env-file-d / --detach--restart--network-w / --workdir--hostname--cap-add--cap-drop--memory / -m--cpus--link (deprecated)

You have a long docker run command with dozens of flags — ports, volumes, environment variables, restart policies, network settings — and you need to move it into a docker-compose.yml file. Translating each flag by hand is tedious and error-prone. This tool parses your docker run command and outputs a valid docker-compose.yml service definition instantly.

Why Convert to Docker Compose?

docker run commands work fine for quick one-off containers, but they become unmanageable when you need to:

What Gets Parsed

The converter handles all common docker run flags:

How to Use

  1. Paste your docker run command into the input area
  2. The tool parses it and generates the equivalent docker-compose.yml
  3. Copy the output and add it to your project’s compose file
  4. Run docker compose up to verify it works identically

Example

Input:

docker run -d --name redis -p 6379:6379 -v redis-data:/data --restart unless-stopped redis:7-alpine

Output:

version: "3.8"
services:
  redis:
    image: redis:7-alpine
    ports:
      - "6379:6379"
    volumes:
      - redis-data:/data
    restart: unless-stopped
volumes:
  redis-data:

Frequently Asked Questions

Does this handle multi-line docker run commands? Yes. Commands split across multiple lines with \ (backslash continuation) are joined and parsed as a single command.

What docker-compose version does it output? The tool generates version “3.8” format by default, which is compatible with Docker Compose V2 and most CI/CD platforms.

Can I convert multiple docker run commands at once? Paste each command separately. The tool converts one service at a time — you can then combine the outputs into a single compose file.

Is my command sent to a server? No. All parsing happens in your browser using JavaScript. No data is transmitted anywhere.

What if my command uses flags the tool doesn’t recognize? Unrecognized flags are preserved as comments in the output so you can manually map them to the appropriate compose directive.

Related Tools

More Docker & DevOps Tools