Utilo

docker run ↔ Compose Converter

Convert docker run commands into docker-compose / compose.yaml services, including ports, env, volumes, networks, healthchecks and resource limits — or convert compose services back to docker run.

What this converter does

A docker run command that started as a quick experiment tends to grow: ports, volumes, environment variables, a network, a restart policy. At some point it belongs in a compose.yaml. This converter parses one or more docker run commands and produces a clean Compose file with one service per command. It also works in reverse: paste a Compose file and get the equivalent docker run commands, which is handy for debugging a single service or running it on a host without Compose. Parsing happens locally in your browser.

How to use it

  1. Select docker run → compose or compose → docker run.
  2. Paste your commands, one per line. Backslash line continuations are fine, and a leading sudo is ignored.
  3. Review the generated YAML. Named volumes and custom networks are declared at the top level automatically.
  4. Read the notes for options that have no Compose equivalent.
  5. Copy the output, save it as compose.yaml and run docker compose up -d.

Supported options

Ports (-p, --expose), environment (-e, --env-file), volumes and mounts (-v, --mount, --tmpfs), networking (--network, --network-alias, --ip, --hostname, --add-host, --dns, --link), restart policy, user and working directory, entrypoint and command, labels, logging driver and options, health checks (--health-*), resource limits (--memory, --cpus, --shm-size, --ulimit, --gpus), security options (--privileged, --cap-add, --cap-drop, --security-opt, --read-only), devices, sysctls, --init, --platform, --pull, -it and more.

Tips

  • Service names come from --name; if absent, the image name is used.
  • --rm and -d have no meaning in Compose and are dropped with a note.
  • Relative bind mounts in Compose are resolved relative to the Compose file, not your shell's directory. Use ./data style paths.
  • Secrets passed with -e end up in plain text. Consider moving them to an .env file and referencing ${VAR}.

Frequently asked questions

Which Compose version is generated?

The output follows the current Compose Specification used by Docker Compose v2. The obsolete top-level version: key is omitted.

Can I convert several containers at once?

Yes. Paste multiple docker run commands and each becomes a service in the same file, sharing declared networks and volumes.

Does compose → run support build sections?

build: has no docker run equivalent, so the tool uses the image name and adds a note telling you to build first.

Is my command uploaded?

No. Conversion is done entirely in your browser.

Yes. All processing happens directly in your browser using JavaScript, Web Workers and Web APIs. Nothing you type, paste or upload is sent to our servers.