Docker Run ⇄ Compose

Turn docker run commands into a Compose file, or a Compose file into docker run commands, with every flag mapped or listed.

Runs in your browser. Nothing is uploaded.

Updated

docker runRuns in your browser
Then start it
docker compose up -d
Your text stays on this device. No upload required.

How to use Docker Run ⇄ Compose

  1. Choose the direction and paste the commands or the compose.yaml.
  2. Read the notes for anything without an equivalent.
  3. Copy or download the result, then run docker compose up -d.

Docker Run ⇄ Compose at a glance

Typical use: Turn the long docker run from a README into a compose.yaml you can keep in Git.

Runs in your browser; nothing is sent anywhere. Output checked with docker compose config.

When to use Docker Run ⇄ Compose

Project READMEs often give a long docker run command. That is fine once, but a Compose file is easier to keep: every setting is written down, it can go into Git, and docker compose up -d starts everything again the same way after a reboot or an update.

This page turns one or more docker run commands into a compose.yaml, and a Compose file back into docker run commands, as you type. Anything without an equivalent is listed, not dropped quietly.

Docker Run ⇄ Compose examples

A database from its README. Paste the docker run for Postgres with its ports, password, volume and health check: the volume is added to the top-level volumes: list, and the health check becomes a healthcheck:.

Several containers. Paste one command a line, for example an app and Redis: each becomes a service in the same file, named after --name or the image.

Back to a command. Choose Compose → docker run to try one service without Compose, or to run it on a machine where only Docker is installed.

What is converted

  • Ports, volumes and --mount, environment and env files, restart, name, networks (host networking too), user, working directory, entrypoint and command, labels, extra hosts, DNS, capabilities, devices, privileged, read-only, init.
  • Limits and runtime: memory, CPUs, shared memory, ulimits, tmpfs, sysctls, security options, stop signal and timeout, logging, health checks, GPUs (--gpus → deploy.resources), platform and pull policy.
  • -d isn’t needed in Compose; --rm and -P have no equivalent and are noted. Networks given with --network are marked external, because docker run expects them to exist.

Prefer the terminal?

To check the result, or turn a running container into a command:

docker compose config

docker compose config reads compose.yaml, fills in defaults and reports any mistake. For a container that is already running, docker inspect shows every setting it was started with.

Frequently asked questions

Is anything sent to a server?

No. The commands are read and converted in your browser, so passwords in -e flags stay on your device.

Do I need version: in the Compose file?

No. The version: key is obsolete in the Compose Specification used by Docker Compose v2 and later, and the page leaves it out. Compose ignores it if it is there.

Is the YAML valid?

The output was checked with docker compose config (Docker Compose 5.7) on many example commands. Run docker compose config yourself to see the full file with Compose’s defaults filled in.

Why does Compose name my container differently?

Without container_name, Compose names containers project-service-1. The page keeps --name as container_name so the name stays the same; remove it if you want to run more than one copy.

Does it work with Podman?

Yes, podman run and nerdctl run commands are read the same way, and podman compose and podman-compose read the same compose.yaml.