RunOfflineTools Logo RunOfflineTools
🐳 DevOps & Containerization

Docker Run ⇄ Docker Compose Converter

Convert single docker run commands into clean docker-compose.yml files, or deconstruct Compose stacks back into CLI terminal commands.

⚑ Presets:

Paste any single or multi-line `docker run` command with flags (-p, -v, -e, --restart, etc.):

πŸ”’ 100% Client-Side Safe
services:
  my-nginx:
    image: nginx:alpine
    container_name: my-nginx
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./html:/usr/share/nginx/html:ro
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
πŸ”„ True Two-Way Conversion

Convert CLI flags to Compose YAML or deconstruct Compose services back into terminal commands.

πŸ›‘οΈ Healthchecks & Resource Limits

Full support for --health-cmd, CPU/Memory resource constraints, and restart policies.

πŸ“¦ Named & Bind Volumes

Automatically extracts named volumes to top-level volumes: declarations with read-only flags.

πŸ” Zero Server Transmission

Environment tokens, database passwords, and secrets stay strictly in your local browser JavaScript runtime.

Why Convert Between Docker Run and Docker Compose?

Containerized development requires flexibility between ad-hoc terminal debugging and reproducible infrastructure-as-code. Developers frequently encounter two opposite challenges:

Docker Run Flags vs. Docker Compose Directives

The table below outlines how common Docker CLI flags map to modern Docker Compose Specification keys:

Docker Run Flag Compose YAML Directive Purpose
-p 8080:80 ports: - "8080:80" Binds host port 8080 to container port 80
-v ./data:/app:ro volumes: - ./data:/app:ro Binds host directory with read-only permission
-e DB_PASS=secret environment: - DB_PASS=secret Passes environment variables to container processes
--restart unless-stopped restart: unless-stopped Defines container crash and system reboot recovery
--health-cmd "curl -f ..." healthcheck: test: [...] Monitors application health status for service readiness
--memory 1g --cpus 2 deploy: resources: limits: ... Prevents container out-of-memory crashes on shared hosts

Handling Named Volumes vs. Host Bind Mounts

Docker distinguishes between host bind mounts (which point to specific directories on the host operating system) and Docker-managed named volumes (stored under /var/lib/docker/volumes/):

Security & Privacy: 100% In-Browser Execution

When dealing with infrastructure commands, developers frequently paste sensitive credentials such as database passwords, Stripe webhooks, or AWS credentials in -e flags. Unlike legacy online converters that send your commands to external backend servers, this tool parses every token using in-browser JavaScript. Your infrastructure commands and secrets never leave your device.