docker run to Compose
Turns a docker run command line into a compose service definition, and converts back the other way.
Converts a `docker run` command line into the `compose.yaml` service it corresponds to. The command is split with real shell quoting rules, so an entrypoint written as `sh -c "…"` survives with its spaces and quotes intact.
docker run command
compose.yaml
Notes
- -d only affects the docker run invocation itself; Compose has no equivalent, so it was dropped.
sh -c "…" survives with its spaces. Flags without a Compose equivalent (--rm, -d) are dropped with a note — Compose decides lifecycle itself — and unknown flags are named, never silently eaten. Ports are quoted in the output because YAML 1.1 would otherwise read 8080:80 as a base-60 number.How to use it
Paste the command
Line continuations, quoted values and a trailing command after the image are all handled. Nothing is executed — this is text in, text out.
Read the notes under the output
Flags with no Compose equivalent are listed rather than dropped silently, and an unknown flag is named. That list is the part worth checking before you commit the file.
Copy it into your compose file
The output is one service. Put it under `services:` alongside whatever else you have, and give it the name you want if the command had no `--name`.
Common questions
Why are the ports quoted?
Because YAML 1.1 reads `8080:80` as a base-60 number — the sexagesimal syntax nobody wanted and every YAML parser inherited. Quoting is what keeps it a port mapping. This is the classic Compose foot-gun.
What happened to `--rm` and `-d`?
Dropped with a note, because Compose owns lifecycle. `docker compose up` is the detached/attached decision and `docker compose down` removes containers, so those flags have no service-level equivalent to translate into.
Does it write a whole compose file?
It writes the service. Networks, volumes at the top level, and a `version:` key (which modern Compose no longer wants) are yours to add — and mostly you should not need them.
Feed it from
chmod Calculator
Converts between octal, symbolic and checkbox permission views, including setuid and sticky bits.
.env Parser & Converter
Parses a .env file and converts it to JSON, YAML, shell exports, Docker or Kubernetes formats.
Docker Image Explorer
Opens an exported image tarball and shows each layer’s command, size and the files it added or deleted.
JSON Formatter & Validator
Pretty-prints, minifies and validates JSON, pointing at the exact line and column of a syntax error.
Next
These accept what this tool produces, so the result can go straight in.
Docker Image Explorer
Opens an exported image tarball and shows each layer’s command, size and the files it added or deleted.
.env Parser & Converter
Parses a .env file and converts it to JSON, YAML, shell exports, Docker or Kubernetes formats.
Kubernetes Secret Decoder
Decodes every Base64 value in a Secret manifest, and re-encodes an edited one ready to apply.
YAML Formatter & Validator
Re-indents YAML consistently, validates it, and flags the tab and anchor mistakes that break parsers.
Base64 Encoder & Decoder
Encodes and decodes Base64 and Base64URL for text or files, handling UTF-8 correctly.
curl to Code
Converts a curl command into fetch, axios, Python requests, Go, PHP or PowerShell.