Podman Guide¶
DockerWorks supports Podman (Podman 4.1+ via podman compose) for both rootful (system-wide) and rootless (per-user) deployments.
Prerequisites¶
- Podman 4.1+
- A Compose provider supported by
podman compose(such asdocker-compose) podman.socketenabled via systemd
Configuration¶
Set defaults.runtime to "podman" in your config.yaml:
When defaults.runtime: "podman" is set:
defaults.compose_commandautomatically defaults to"podman compose"(unless explicitly overridden).auto_prune: trueexecutespodman image prune -f.docker-works doctorcheckspodman --version,podman compose version, andpodman info.- Registry digest polling checks Podman's
auth.json($REGISTRY_AUTH_FILE,$XDG_RUNTIME_DIR/containers/auth.json,~/.config/containers/auth.json) in addition to~/.docker/config.json.
Rootful Podman (System Service)¶
- Enable the system Podman socket:
- Install using the automated installer with
--runtime podman, or copypackaging/systemd/docker-works-podman.service:
sudo cp packaging/systemd/docker-works-podman.service /etc/systemd/system/docker-works.service
sudo systemctl daemon-reload
sudo systemctl enable --now docker-works
- Verify the host environment:
Best Practice: System Mode vs. User Mode¶
Match docker-works's systemd scope to the privilege level of your Podman containers and Quadlets:
- Rootless Podman / Quadlets (Recommended for most apps) → Run
docker-worksin User Mode (systemctl --user): Running as a non-root user automatically setsquadlet.user_mode: true, targets~/.config/containers/systemdand~/.config/systemd/user, and runssystemctl --userinside the same user session as your containers. - Rootful Podman / Quadlets → Run
docker-worksas a System Service (sudo systemctl): Use this only when your containers requireroot(e.g., privileged ports< 1024without sysctl tweaks, host device access, or/etc/containers/systemd).
Rootless Podman (User Service)¶
- Enable the user-level Podman socket and lingering so services stay active after logout:
- Create
~/.config/docker-works/config.yamlwithruntime: "podman"and a user-writablestate_dir:
defaults:
runtime: "podman"
state_dir: "/home/youruser/.local/share/docker-works"
apps:
- name: "my-app"
git:
repo: "https://github.com/myorg/infra.git"
-
Enable and start the user service:
-
If installed via
.deb/.rpmpackage: -
Or if installing the unit manually (e.g. from tarball / source):
-
Verify and stream logs:
docker-works doctor --config ~/.config/docker-works/config.yaml
journalctl --user -u docker-works-podman -f # or -u docker-works if copied manually
Podman Quadlets (mode: "quadlet")¶
In addition to podman compose, DockerWorks supports Podman Quadlets (Podman 4.4+), syncing .container, .pod, .kube, .network, .volume, .image, and .build unit files into systemd's Quadlet directory, running systemctl daemon-reload, restarting the generated services, and monitoring unit health for automated rollback.
Example Quadlet App Configuration¶
defaults:
runtime: "podman"
apps:
- name: "my-quadlet-app"
mode: "quadlet" # Optional if quadlet: block is present
quadlet:
# dir defaults to /etc/containers/systemd (root) or ~/.config/containers/systemd (rootless)
# files: ["app.network", "web.container"] # Auto-discovers quadlet files in work_dir if omitted
# services: ["app-network.service", "web.service"] # Auto-derived if omitted
# user_mode: true # Auto-detected from UID if omitted
git:
repo: "https://github.com/myorg/quadlet-infra.git"
branch: "main"
path: "apps/web"
auto_rollback: true
auto_prune: true
How Quadlet Sync Works¶
- Syncs Quadlet unit files from
work_dirinto<quadlet.dir>/<app.name>/(removing stale unit files from previous commits), and syncs any.timerfiles intoquadlet.systemd_dir(/etc/systemd/systemor~/.config/systemd/user). - Rewrites portable
./relative paths (see below) to absolute paths underwork_dirwhen writing synced Quadlet files. - Pulls any
Image=references declared in the Quadlet files usingpodman pull. - Runs
systemctl [--user] daemon-reloadso Podman's Quadlet generator updates the systemd units. - Restarts long-running and standalone
Type=oneshotservices in dependency order:.network→.volume→.image→.build→.pod→.kube→.container. Any.timerunits are enabled/started (systemctl [--user] enable --now+restart) without immediately firing their target batch.service. - Monitors
systemctl [--user] show <unit>until units areactive(orinactivewithResult=successforType=oneshotbatch tasks), triggering rollback if any unit entersfailed.
Portable Relative Paths (./)¶
Because Quadlet unit files are copied into <quadlet.dir>/<app.name>/, relative paths inside .container or .kube files would normally fail to resolve against your Git repository. DockerWorks automatically rewrites ./ paths relative to each Quadlet file's directory (<work_dir> or <work_dir>/<subdir> when using subdirectory entries in quadlet.files) for the following directives:
Volume=./<path>:<container_path>[:<options>]EnvironmentFile=./<path>andEnvironmentFile=-./<path>Yaml=./<path>(.kubeunits)ConfigMap=./<path>(.kubeunits)SeccompProfile=./<path>(.containerunits)
Absolute paths (e.g. /data/kafka), systemd specifiers (e.g. %h/...), and named volumes (e.g. mydata.volume:/data) are left untouched:
[Container]
Image=prom/prometheus:latest
# Versioned config file in Git -> rewritten to <work_dir>/prometheus.yml
Volume=./prometheus.yml:/etc/prometheus/prometheus.yml:Z,U
# Persistent host data directory -> left untouched
Volume=/data/kafka:/prometheus:Z,U
# Optional .env file in Git -> rewritten to -<work_dir>/app.env
EnvironmentFile=-./app.env
Batch Tasks (Type=oneshot & .timer Units)¶
- Deploy-time batch jobs (
Type=oneshot): Add[Service]\nType=oneshotin your.containerunit. DockerWorks restarts the unit on deploy and treatsActiveState=inactivewithResult=successas a successful run. - Scheduled batch jobs (
.timer): Place a matching<name>.timer(or specifyUnit=<target>.servicein[Timer]) alongside<name>.container. DockerWorks syncs the.timerintoquadlet.systemd_dir, enables and restarts the timer, and skips running the target.serviceimmediately on deploy.
Unit Name Mapping & Overrides¶
By default, DockerWorks derives the systemd unit name from the Quadlet filename:
| Extension | Generated Unit |
|---|---|
.container, .kube |
<name>.service |
.pod |
<name>-pod.service |
.network |
<name>-network.service |
.volume |
<name>-volume.service |
.image |
<name>-image.service |
.build |
<name>-build.service |
If you set ServiceName= inside a Quadlet file or specify quadlet.services in config.yaml, DockerWorks uses those unit names instead.