Docker Run to Compose Converter – Generate compose.yaml Online

Turn a literal docker run command into reviewable Compose YAML on your device, with explicit errors for unsupported options.

Runs locally
Ready to convert

Browser-only parser for one literal docker run command (max 32,000 characters). It never executes Docker, expands Shell expressions, reads files, or sends configuration to VetaTool. Secret masking is best-effort. Review generated YAML, env_file paths, network and mount semantics before using it.

Paste a literal command, including image and optional container arguments.

181 chars

Compose Specification YAML (no obsolete version field); validate before deployment.

0 chars

Docker run to Compose conversion guide

How to convert a Docker run command to Compose YAML

Paste a single literal docker run command to generate a Compose Specification service definition. Supported flags include container name, ports, volumes, environment variables, env files, restart, network and entrypoint. All parsing happens locally; commands are never executed. This tool is free to use. No account or payment is required.

Last updated

What you can do here

  • Docker run argument parsing
  • Compose Specification YAML output
  • Port and volume mapping
  • Environment variable masking
  • External network references
  • Entry point and command preservation
  • Unsupported flag errors
  • Browser-local conversion and YAML download

How to use

  1. Paste one literal docker run command (32,000 characters maximum), including its image and optional container command.
  2. Keep the default secret masking option enabled to redact common password and token environment variables.
  3. Select Convert Docker run to produce Compose Specification YAML; unsupported options will show a clear error.
  4. Check volumes, ports, env_file references, networks and warnings before downloading compose.yaml or copying it.

Supported Docker run options and Compose mapping

The first version maps --name, -p/--publish, -v/--volume, -e/--env, --env-file, --network, --restart, --entrypoint, -i, -t and the container's command arguments. It uses current Compose Specification syntax without an obsolete version field.

The detached -d flag is represented by a warning to use docker compose up -d. Host networking cannot be combined with published ports. Custom networks are treated as external and must exist beforehand.

Safe translation requires explicit errors

This tool parses text; it does not invoke a shell, Docker daemon, filesystem or HTTP request. Pipes, substitutions, redirects, unsupported Docker flags, --mount, and --privileged are rejected rather than silently producing incomplete YAML.

Docker CLI argument parsing differs across Bash, PowerShell and CMD. This MVP handles common literal quotes and Windows drive volume paths, but does not interpret arbitrary shell escaping, environment interpolation, or platform-specific mounts.

Secret masking, env files and literal dollars

Common environment secret names are redacted by default; masking is best-effort and does not guarantee all secrets are removed, especially those embedded in commands, images or paths. Never share unreviewed generated YAML.

Literal dollar signs are escaped for Compose interpolation. Referenced env_file paths are not opened and must be supplied alongside your Compose project. The generated file is a starting point, not a validated deployment.

Convert a container with a published HTTP port

A small docker run command becomes an editable Compose service with the image and port binding retained.

Docker run command

docker run --name demo -p 8080:80 nginx:alpine

Compose YAML

services:
  "demo":
    image: "nginx:alpine"
    container_name: "demo"
    ports:
      - "8080:80"

Common questions

Frequently asked questions

Does this converter execute Docker commands?

No. It only parses literal text locally in the browser. It never runs Docker, Shell commands or network calls.

Which Docker flags are supported?

Common container names, ports, volumes, environment variables, env files, networks, restart policies, entrypoints and commands are mapped. Unsupported options cause an explicit error.

Why is there no version key in compose.yaml?

Modern Compose Specification files do not require the old top-level version field.

Does the tool preserve secrets?

Common secret-valued environment variables are masked by default. This is best-effort; review all generated output and do not paste credentials into shared documents.

Can I convert --privileged, --mount or shell pipelines?

Not in this MVP. These cases are rejected instead of generating YAML that could silently change behavior.

Debugging a specific YAML issue? Browse YAML troubleshooting.