Microdeck.tools 100% In-Browser

Docker Run ↔ Compose YAML Converter

New

Bidirectional container config translator for DevOps workflows. Convert long multiline `docker run` commands (ports, volumes, environment variables, networks, restart policies, and entry commands) into valid `compose.yaml` definitions—or convert `compose.yaml` service blocks back into copy-ready `docker run` commands.

100% In-Browser No Server Storage Instant Results
Generated compose.yaml

Did this tool save you time? Help keep Microdeck free and maintained. Completely optional · From $3.

How It Works Under the Hood

The CLI tokenizer handles POSIX shell line continuations (`\`), quoted values, and combined short flags (`-dit`), mapping `-p`, `-v`, `-e`, `--name`, `--restart`, `--network`, and trailing image/command arguments into structured YAML. Reverse parsing extracts service keys from indentation-based `services:` YAML sections.

Step-by-Step Instructions

1

Pick conversion direction (`docker run -> compose.yaml` or `compose.yaml -> docker run`).

2

Paste your container CLI command or Compose YAML service specification.

3

Inspect warnings for unsupported custom daemon flags if any appear.

4

Copy the output or download `compose.yaml` / `docker-run.sh` directly.

Key Features & Performance

  • Handles multi-line `\` shell continuations and quoted arguments cleanly
  • Maps `-p` ports, `-v` volumes, `-e` environment variables, `--restart`, `--network`, and command overrides
  • Produces modern Compose v2 spec without deprecated top-level `version:` boilerplate
  • Supports reverse translation from `compose.yaml` services back into individual `docker run` CLI commands
  • Offline execution keeps private registry URLs and database environment vars private

Methodology, Formulas & Technical Standards

Shell tokenization implements state-machine quote handling (`'`, `"`, escaping) before flag-pair resolution (`--flag=val` and `--flag val`). YAML emission escapes colons and shell characters consistently and generates valid named/anonymous service blocks.

Common Real-World Use Cases

  • Migrating one-off `docker run` commands from documentation into version-controlled `compose.yaml` stacks
  • Converting complex multi-container Compose files back into standalone `docker run` commands for CI runners
  • Quickly reviewing exposed ports and mounted host paths in copied container snippets
  • Onboarding teammates with reproducible local Postgres/Redis Compose templates

Worked Examples & Edge Cases

Redis CLI -> compose.yaml

Input
docker run -d --name cache -p 6379:6379 -v redis_data:/data redis:7-alpine
Output
services:
  cache:
    image: redis:7-alpine
    ports:
      - "6379:6379"

Automatically infers the Compose service key from `--name` or image name.

Compose -> Standalone CLI

Input
services:
  postgres:
    image: postgres:16-alpine
    ports: ["5432:5432"]
Output
docker run -d -p "5432:5432" postgres:16-alpine

Handy when debugging single containers outside Compose.

Limitations, Scope & Accuracy Notes

  • • Advanced Compose keys (`deploy.resources`, `depends_on` healthcheck conditions, complex YAML anchors) are omitted or flagged with warnings during reverse CLI translation.
  • • Verify sensitive `-e` passwords before committing generated YAML files to Git.

Local Browser Processing & Privacy

Traditional web converters upload your documents, snippets, or media files to remote servers. Docker Run ↔ Compose YAML Converter runs inside your browser tab:

Processed in This Tab

Your input text and files are processed locally without uploading payloads to a processing server.

No Tool Payload Logging

Microdeck does not log or store the files or inputs you paste into tool workspaces (normal static hosting/CDN requests still load page assets).

Tab Memory Lifecycle

Working outputs stay in your browser tab and are released when you reset the tool or close the tab.

Frequently Asked Questions

Why does the generated `compose.yaml` omit the `version:` key?

Docker Compose v2 deprecated the top-level `version:` property; modern Compose files start directly with `services:`.

Are multi-line `docker run` commands with `\` supported?

Yes. Escaped line breaks and single/double-quoted flag arguments are normalized automatically before parsing.

Can a `compose.yaml` with multiple services convert back to CLI?

Yes. Each service under `services:` emits its own standalone `docker run` command separated by blank lines.

Is my private image URL or env secret logged?

No. Translation runs synchronously inside browser JavaScript with zero server calls.

Explore Related Micro-Tools

Support Microdeck

Completely optional · From $3 · No account required

Choose an amount (USD):Selected:$5

Minimum support amount is $3 USD.

Completely optional · From $3 · Checkout opens on Gumroad.