# Docker Compose to Run

Convert the services of a Docker Compose file into docker run commands. Each service becomes one multi-line command with its ports, volumes, environment, restart policy, network, resource limits, health check, logging and other options, in YAML or JSON input. Keys docker run cannot express, such as build or depends_on, are listed above the command.

## Frequently asked questions

### Which compose keys are converted?

image, container_name, command, entrypoint, ports, expose, volumes, environment, env_file, restart, network_mode, networks, working_dir, user, hostname, labels, extra_hosts, capabilities, privileged, read_only, init, stdin_open, tty, memory and CPU settings including deploy.resources.limits, shm_size, stop_signal, stop_grace_period, DNS settings, devices, tmpfs, sysctls, security_opt, ulimits, logging, healthcheck, platform, pull_policy and several namespace keys.

### What happens to build, depends_on and similar keys?

docker run has no equivalent for them, so they are listed in a comment above the command for that service. A service with build but no image uses the service name as the image name, so build and tag the image first.

### Why does each command start with -d and --name?

Compose starts containers in the background and gives each one a name, so the commands do the same. The name is container_name when it is set, otherwise the service name.

### What about services on several networks?

docker run connects a container to one network when it starts. The command uses the first network, and the others are listed in the comment; connect them afterwards with docker network connect.

### Are variables like ${TAG} kept?

Yes. Values that contain a dollar sign are written in double quotes, so your shell replaces the variable when you run the command, much like Compose interpolates it. Other values are written in single quotes where needed.

### Does it read the long syntax for ports and volumes?

Yes. Long port entries with target, published, host_ip and protocol and long volume entries with type, source, target and read_only are converted, and tmpfs volumes become --tmpfs.

Your ad here?

[Email us](mailto:hi@dennn.is?subject=Advertising%20on%20OneClick%20Pro)

[Ad 433 tools for your AI agents through one MCP server.](https://multitaskai.com/?ref=oneclickpro)
