Docker Run to Docker Compose Converter

Docker Run to Docker Compose Converter

Local Processing

Convert docker run CLI commands into clean, declarative docker-compose.yml service configurations.

How It Works & Processing Standards

Convert docker run CLI commands into clean, declarative docker-compose.yml service configurations.

Tool processing runs in your browser. If you create a calculator or conversion share link, its values are included in the URL. See the privacy policy for account, analytics and advertising data.

Current Limits

  • Maximum input length: 100,000 characters

Move a long docker run command into a reusable Compose file. Risky options Compose cannot express (such as --cap-add) are reported as errors instead of silently dropped.

What You Can Do

Main options
Moves --name, -p, -e, -v and the image.
Safe refusal
Options it cannot move are reported, not skipped.

How to Use Docker Run to Docker Compose Converter

  1. 1
    Paste the commandPaste the docker run command.
  2. 2
    Read the resultSee the Compose YAML.
  3. 3
    SaveSave as docker-compose.yml.

Examples

nginx container
Input: docker run -d --name web -p 8080:80 -e TZ=Asia/Seoul -v ./html:/usr/share/nginx/html nginx:alpine
Result: services: web: image: nginx:alpine container_name: web ports: - "8080:80" volumes: - "./html:/usr/share/nginx/html" environment: - TZ=Asia/Seoul

Common Use Cases

  • Managing a README’s docker run example with Compose
  • Gathering several containers into one file

Frequently Asked Questions (FAQ)

What about -d (detached)?

In Compose that is chosen at run time with docker compose up -d, so it is not written to the file.

Have feedback or ideas for this tool? Suggest & Inquire →