Skip to content
My Tiny Utils

Search tools

Type to find a tool, then press Enter to open it.

Docker Run to Compose

Convert docker run commands into docker-compose services. Ports, volumes, env vars, networks, restart policies, and more.

Processed locally in your browser — nothing is uploaded.

0 characters

compose.yaml

Output appears here…

About Docker Run to Compose

Long docker run commands are hard to maintain. Paste one and get an equivalent docker-compose service definition. Ports, volumes, environment variables, restart policies, networks, resource limits, and many other flags are mapped to their compose keys.

Common uses

  • Migrate a container from an ad-hoc docker run to Compose
  • Turn a README's docker run example into a compose.yaml
  • Understand what a long docker run command actually configures

Example

Input

docker run -d --name web -p 8080:80 -e NODE_ENV=production nginx:alpine

Output

services:
  web:
    image: nginx:alpine
    container_name: web
    ports:
      - "8080:80"
    environment:
      - NODE_ENV=production

Limitations

  • Flags without a compose equivalent are listed as warnings instead of being dropped silently