Compose Rewrite
Last updated
This page explains how PodRun generates docker-compose.podrun.yml on the remote host so the same compose file runs on remote Podman without edits.
Why a Copy
A local docker-compose.yml usually binds host ports (8080:80), which collide on a shared remote host, and relative-path volumes need the :z label on SELinux hosts. PodRun rewrites only the remote copy and leaves the local file untouched.
Steps
| Step | Action |
|---|---|
| 1 | Look for docker-compose.yml, then docker-compose.yaml on the remote host; return an error if neither exists |
| 2 | Copy it to docker-compose.podrun.yml |
| 3 | Strip host ports with three sed rules |
| 4 | Append :z to volumes starting with ./ using awk |
Port Stripping Rules
| Original | Rewritten |
|---|---|
"8080:80" |
"80" |
${WEB_PORT}:80 |
80 |
${WEB_PORT:?error}:80 |
80 |
With host ports removed, Podman assigns random host ports to container ports; the podman ps table printed at the end of up -d shows the actual mappings.
Volume Rules
| Original | Rewritten |
|---|---|
- ./data:/data |
- ./data:/data:z |
- ./data:/data:ro |
Intended - ./data:/data:ro,z; the implementation uses gsub with a \1 backreference, which POSIX awk gsub does not support, so the actual output is unverified |
- ./data:/data:ro,z |
Unchanged |
Only relative volumes starting with ./ are touched; named volumes and absolute paths stay as-is. The rules use \s, so the remote awk must support it (for example gawk); the macOS system awk does not, and the rules never match there.
Execution
up first clears old containers with podman compose -f docker-compose.podrun.yml down -v, then runs your command, such as up -d, with the same file. clear also uses this copy.
Passthrough commands (down, ps, logs, and others) currently run podman compose <args> in the remote folder without -f docker-compose.podrun.yml.