Docker Compose to docker run Converter

Turn a Compose file into the equivalent docker run commands. Some of what Compose was doing for you has no flag, and the first one bites immediately.

Paste below, or drop a file anywhere on this panel

Or drop a file anywhere on this panel. Nothing is uploaded: the analysis runs in this tab.

The answer appears here

Paste on the left and press Convert. Nothing leaves this tab.

Examples

Real input you can load into the tool above. Each one shows a different thing going wrong, because that is what the tool is for.

Two services with a dependency

The network is not automatic, and depends_on has no flag

services:
  web:
    image: nginx:alpine
    ports:
      - "8080:80"
    depends_on:
      db:
        condition: service_healthy
  db:
    image: postgres:16

A relative bind mount

Means a different directory once it is on a command line

services:
  app:
    image: myapp
    volumes:
      - "./data:/data"

Common mistakes

These are the ones that fail silently. The config is accepted, nothing raises an error, and the consequence arrives later.

  1. Running the containers without creating a network

    The default bridge provides no DNS, so a service referring to another by name gets a resolution failure that looks like the other container is down.

    Instead:docker network create, then --network on every container.

  2. Expecting depends_on ordering to carry across

    There is no flag for it. Running the commands in order reproduces the short form, and nothing reproduces a health condition.

    Instead:Run them in order, and make the application retry its connections.

  3. Copying relative volume paths straight across

    Compose resolves them against the compose file; docker run resolves them against your shell's directory, and -v creates the missing path rather than failing.

    Instead:Make them absolute before running the commands.

Compose gives you a network and DNS; docker run gives you neither

Every service in a project joins one network and reaches every other by service name. Run the same containers without that and a reference by name is a DNS failure.

The default bridge has no name resolution at all

So it is not enough to run the containers: they have to share a user-defined network, which you create yourself. That is the first line of the output here, and leaving it out is why a hand-converted stack cannot find its own database.

depends_on has no equivalent

The short form waits for the container to start, which running the commands in order reproduces. The long form with condition: service_healthy waits for a healthcheck to pass, and there is no docker run flag for that at all: you would have to poll docker inspect yourself.

Which is a reminder that depends_on was never a readiness guarantee

The short form is satisfied when the container starts, not when the database accepts connections. The real answer in both worlds is an application that retries its connections.

Relative volume paths change meaning

Compose resolves them against the compose file's directory; docker run resolves them against wherever you are standing. And -v creates a missing host path as an empty root-owned directory rather than failing, so the mount silently points at nothing.

${ } is resolved by Compose, not by your shell

Compose reads .env from the project directory and substitutes before parsing. Your shell knows nothing about that file, so the same expression expands differently, or to nothing.

This direction loses structure

A compose file describes services and relationships. A list of commands describes a sequence, and the relationships end up in a shell script or in somebody's head. Worth doing to understand what Compose was doing, or for a host without it. Not worth doing as a migration.