myapp_default, myapp-web-1) — by default the folder name.
Paste one or more docker run / podman run commands — also docker network create and docker volume create. Converts as you type; quoting, \ line breaks, -dp 80:80 and --mount are understood. Variables like $HOME stay variables (Compose fills them in), quoted '$5' becomes $$5.
Docker / Podman Run Command
Docker Compose YAML editable
Paste a compose.yaml — you get a shell script: networks first, then one run per service in depends_on order. ${VAR} stays a shell variable, $$ becomes a literal $; everything else is single-quoted.
Docker Compose YAML
Generated Run Commands
Flag Reference: docker run → Compose
| docker run flag | Compose key | Notes |
|---|---|---|
| Container Identity | ||
--name NAME | container_name: NAME | Also used as service name. Back in run: without container_name the name is project-service-1, like Compose |
--hostname HOST | hostname: HOST | |
--platform linux/amd64 | platform: linux/amd64 | |
| Image & Command | ||
IMAGE[:TAG] | image: IMAGE[:TAG] | Positional argument |
COMMAND [ARGS] | command: COMMAND | After image name |
--entrypoint CMD | entrypoint: [CMD] | run takes one program; entrypoint: [sh, -c] becomes --entrypoint sh + -c before the command |
| Ports & Volumes | ||
-p 80:80 | ports: ["80:80"] | Short & long syntax |
--expose 8080 | expose: [8080] | Internal port only |
-v /host:/cnt | volumes: [/host:/cnt] | Bind mount |
-v name:/cnt | volumes: [name:/cnt] | Named volume — declared as external: true, so Compose uses the existing one instead of a new project_name |
--mount type=bind,src=…,dst=… | volumes: [{type: bind, …}] | Long syntax; --mount does not create missing host folders |
--tmpfs /tmp | tmpfs: [/tmp] | |
| Environment | ||
-e KEY=VALUE | environment: [KEY=VALUE] | Or object syntax |
--env-file .env | env_file: [.env] | |
| Network | ||
--network NAME | networks: [NAME] | Declared as external: true unless the input has docker network create NAME. Without --network, run uses the default bridge, Compose its own project_default network |
--network host | network_mode: host | Also none, bridge, container:NAME (Compose: service:NAME) |
--network-alias A, --ip | networks: {NAME: {aliases: [A]}} | Compose adds the service name as alias on every network |
--dns 8.8.8.8 | dns: [8.8.8.8] | |
--dns-search dom | dns_search: [dom] | |
--add-host h:ip | extra_hosts: [h:ip] | |
| Lifecycle | ||
--restart POLICY | restart: POLICY | no, always, unless-stopped, on-failure |
-d / --detach | — | Implicit in Compose |
--rm | — | No equivalent — docker compose run --rm for one-off runs |
--pull always | pull_policy: always | |
--stop-signal SIG | stop_signal: SIG | |
--stop-timeout N | stop_grace_period: Ns | Back in run: durations like 1m30s become seconds (90) |
| Runtime Flags | ||
-t / --tty | tty: true | |
-i / --interactive | stdin_open: true | |
--privileged | privileged: true | |
--read-only | read_only: true | |
--init | init: true | |
-u USER | user: USER | |
-w /path | working_dir: /path | |
| Security | ||
--cap-add CAP | cap_add: [CAP] | |
--cap-drop CAP | cap_drop: [CAP] | |
--security-opt OPT | security_opt: [OPT] | |
--device /dev/x | devices: [/dev/x] | |
| Resources | ||
-m 512m | mem_limit: 512m | |
--memory-swap 1g | memswap_limit: 1g | |
--cpu-shares 512 | cpu_shares: 512 | |
--cpus 1.5 | cpus: 1.5 | |
--cpuset-cpus 0-1 | cpuset: 0-1 | |
--shm-size 64m | shm_size: 64m | |
--ulimit nofile=1024:2048 | ulimits: {nofile: {soft: 1024, hard: 2048}} | |
--gpus all | deploy.resources.reservations.devices | Podman: --device nvidia.com/gpu=all (CDI) |
--memory / --cpus | deploy.resources.limits | Both forms are read; mem_limit/cpus are written |
| Logging | ||
--log-driver DRV | logging.driver: DRV | |
--log-opt K=V | logging.options.K: V | |
| Healthcheck | ||
--health-cmd CMD | healthcheck.test: [CMD-SHELL, CMD] | run only knows the shell form; [CMD, …] is quoted word by word |
--health-interval T | healthcheck.interval: T | |
--health-timeout T | healthcheck.timeout: T | |
--health-retries N | healthcheck.retries: N | |
--no-healthcheck | healthcheck.disable: true | |
| Labels | ||
-l KEY=VAL | labels: [KEY=VAL] | |
Compose-only Features
These Compose features have no direct docker run equivalent:
depends_on- Start order — the script keeps it, but conditions like
service_healthyare not waited for build- Becomes
docker build -t project-service …before therun profiles,replicas,scale- Ignored with a note — the command always starts one container
secrets/configs- File-based ones become read-only mounts under
/run/secrets/;environment/contentones get a note - Interpolation
${VAR:-default}stays a shell variable; Compose would also read.env— export those variables first
Restart Policies
| Value | Behavior |
|---|---|
no | Never restart (default) |
always | Always restart |
unless-stopped | Restart unless manually stopped |
on-failure | Only on non-zero exit |
on-failure:3 | Max 3 retries |
Tips
- Use
\at line end to break long commands across multiple lines. - Combined flags like
-it,-dp 80:80or-p8080:80and both--flag valueand--flag=valueare understood. - Several
runcommands become several services in one file; anything that cannot be converted is listed under the output. - Check the result with
docker compose config— it reports undefined networks and volumes. - Quote port mappings (
"8080:80"): older YAML readers take22:22as a number in base 60.