Docker Run to Docker Compose

Compose Spec

Convert docker run or podman run CLI flags into structured docker-compose.yml files in your browser.

docker run CLI Command
0 chars Shell CLI
docker-compose.yml
0 lines Compose YAML

About This Tool

Translating long, multi-flag docker run commands from README files or shell history into declarative docker-compose.yml manifests by hand is tedious and error-prone. This utility tokenizes POSIX shell arguments, quotes, and backslash line continuations directly in browser memory.

Once converted into a Compose service definition, you can copy the YAML, download it as docker-compose.yml, or pipe the output directly into the Docker Compose to Kubernetes converter.

Key Features

  • Shell-Aware Tokenizer: Handles single quotes, double quotes, escaped spaces, combined short flags (-itd), and multiline backslash continuations.
  • Resource & Security Mapping: Maps --memory and --cpus into deploy.resources.limits and preserves --cap-add, --cap-drop, and --privileged flags.
  • Direct K8s Piping: One-click transfer sends your generated Compose YAML straight into the Kubernetes Deployment and Service generator.

Frequently Asked Questions

Which docker run flags are supported?
Port mappings (-p, --publish), bind mounts and named volumes (-v, --volume), environment variables (-e, --env, --env-file), container names (--name), restart policies (--restart), networks (--network), CPU and memory limits (--cpus, -m), working directory (-w), user (-u), entrypoint, labels, capabilities (--cap-add, --cap-drop), and interactive/TTY flags (-i, -t).
Can I paste multiline commands with backslash continuations?
Yes. Backslash line continuations (\) and single or double quoted arguments are normalized and tokenized automatically before generating the Compose YAML.
How are custom networks handled in the generated YAML?
If your command specifies a custom network via --network (anything other than bridge, host, or none), the converter appends a top-level networks block marked as external: true.
Can I pipe the generated Compose YAML into Kubernetes manifests?
Yes. Click "Send to Compose -> K8s" in the output toolbar to pass your generated docker-compose.yml directly into the Docker Compose to Kubernetes converter.