25.5. Docker and Compose Interoperability
Few sites are greenfield: images arrive tagged for Docker, tutorials assume
docker commands, and multi-service projects ship a compose.yaml. Debian
13 ships both ecosystems, and Podman deliberately imitates Docker's command
line and API so most material written for one works with the other. This
section installs both stacks side by side on ctr1, shows exactly where they
agree and differ on the same host, and ends with a rule for choosing
Compose or Quadlet for a given workload.
25.5.1. Comparing Docker and Podman Daemons, APIs, and Rootless Behavior
The architectural difference is one word: Docker has a daemon and Podman
does not. docker commands are clients that talk to dockerd, a
long-running root process that owns the images, containers, networks, and
firewall rules; podman commands do the work themselves in the invoking
user's context and exit. Everything else - rootless behavior, storage
layout, API sockets, firewall integration - follows from that split.
| Aspect | Podman | Docker |
|---|---|---|
| Architecture | process per command, no daemon | dockerd system service, clients talk to it |
| Rootless mode | the default model; separate store per user | separate rootless daemon mode; rootful is the classic deployment |
| systemd integration | Quadlet units, user or system (Section 25.4) | the daemon is a systemd unit; containers depend on it |
| API | optional, Docker-compatible socket on demand | the core of the design, always present |
| Rootful storage | /var/lib/containers |
/var/lib/docker |
| Firewall | netavark rules under its own chains | iptables-nft rules in DOCKER* chains |
Install the Docker side of the comparison. On ctr1, as john:
$ sudo apt install docker.io docker-compose podman-compose
The command prompts for confirmation; docker.io is Debian's Docker
Engine, docker-compose provides the Compose v2 plugin for it, and
podman-compose is the community Python front end that drives plain
Podman. Debian's docker.io package starts the daemon automatically.
Access to it is group-based: members of the docker group reach the
daemon's socket with full control, which is why the group is also a
significant privilege grant - treat membership like sudo. Add john to
the group. On ctr1, as john:
$ sudo usermod -aG docker john
The command produces no output, and the membership takes effect at the next login, so john must log out and back in (or open a fresh SSH session) before the following examples work. Confirm the group and the daemon. On ctr1, as john, after a new login:
$ id
uid=1001(john) gid=1001(john) groups=1001(john),104(docker)
$ docker version --format '{{.Server.Version}}'
26.1.5+dfsg1
The server version answers, which means the CLI reached the daemon without sudo - group membership did that. The daemon's own view, including its storage and cgroup drivers, needs no such indirection. On ctr1, entered by john:
$ sudo docker info --format '{{.ServerVersion}} {{.Driver}} {{.CgroupDriver}}'
26.1.5+dfsg1 overlay2 systemd
The same three-part shape as Podman's report: an overlay-family storage
driver and systemd's cgroup hierarchy. What differs is who owns it all -
one root-owned daemon - and therefore what a compromise of that daemon
means. Docker also has a rootless mode, in which a per-user dockerd runs
inside a user namespace much like rootless Podman; it was not part of this
exercise, and the comparison here is between rootful Docker and rootless
Podman, the two default postures on Debian.
The API difference is where the ecosystems meet. Podman can expose exactly the socket Docker clients expect, on demand, in the user's own runtime directory. On ctr1, as john:
$ systemctl --user start podman.socket
The socket unit produces no output. Probe it with the Docker API's own health endpoint. On ctr1, as john:
$ curl --unix-socket /run/user/$(id -u)/podman/podman.sock http://d/_ping
OK
Selected output; curl prints its transfer progress meter on standard error,
which is omitted here. The /_ping endpoint answered OK - the API
Podman serves is the one docker speaks. Point the Docker client at it
with DOCKER_HOST. On ctr1, as john:
$ DOCKER_HOST=unix:///run/user/$(id -u john)/podman/podman.sock docker version --format '{{.Server.Version}}'
5.4.2
The Docker CLI, unmodified, just talked to rootless Podman and reported
Podman's version as the server. Tools that only know the Docker API -
older build systems, CI scripts that call docker - can therefore run
against a rootless Podman store by setting one variable, without any daemon
running as root.
25.5.2. Reading Compose Service, Network, Volume, and Secret Definitions
A Compose file describes a whole small deployment: services, the networks
between them, the volumes they share, and the files injected as
configuration or secrets. The example project serves one page through
nginx, with a Redis cache alongside it, and exercises every interesting
Compose feature. Its files live under
~/debian-handbook/containers/compose/; create index.html there with:
Compose workshop page
and app_secret.txt with:
compose-example-secret
Then compose.yaml itself:
name: handbook-compose
services:
web:
image: docker.io/library/nginx:1.27-alpine
ports:
- "192.168.245.10:8081:80"
volumes:
- webcache:/var/cache/nginx
configs:
- source: index
target: /usr/share/nginx/html/index.html
mode: 0444
secrets:
- app_secret
healthcheck:
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1/"]
interval: 5s
timeout: 3s
retries: 5
cache:
image: docker.io/library/redis:7.4-alpine
command: ["redis-server", "--save", "60", "1"]
volumes:
- cachedata:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
volumes:
webcache:
cachedata:
configs:
index:
file: ./index.html
secrets:
app_secret:
file: ./app_secret.txt
Reading it top to bottom: the name fixes the project name, so every
object Compose creates is prefixed handbook-compose_. The web service
publishes the lab address - the same deliberate pin as
Section 25.3.1 - mounts the webcache volume, receives the page through
a configs entry, and consumes the secret. The cache service runs
Redis with a save policy, writing to its own volume. The top-level
volumes, configs, and secrets blocks declare each object and its
source file. Compose resolves all of this into one model before creating
anything; the config subcommand prints it. On ctr1, as john:
$ cd ~/debian-handbook/containers/compose && docker compose config
name: handbook-compose
services:
cache:
command:
- redis-server
- --save
- "60"
- "1"
healthcheck:
test:
- CMD
- redis-cli
- ping
timeout: 3s
interval: 5s
retries: 5
image: docker.io/library/redis:7.4-alpine
networks:
default: null
volumes:
- type: volume
source: cachedata
target: /data
volume: {}
web:
configs:
- source: index
target: /usr/share/nginx/html/index.html
mode: 292
healthcheck:
test:
- CMD
- wget
- -q
- -O
- /dev/null
- http://127.0.0.1/
timeout: 3s
interval: 5s
retries: 5
image: docker.io/library/nginx:1.27-alpine
networks:
default: null
ports:
- mode: ingress
host_ip: 192.168.245.10
target: 80
published: "8081"
protocol: tcp
secrets:
- source: app_secret
target: /run/secrets/app_secret
volumes:
- type: volume
source: webcache
target: /var/cache/nginx
volume: {}
networks:
default:
name: handbook-compose_default
volumes:
cachedata:
name: handbook-compose_cachedata
webcache:
name: handbook-compose_webcache
secrets:
app_secret:
name: handbook-compose_app_secret
file: /home/john/debian-handbook/containers/compose/app_secret.txt
configs:
index:
name: handbook-compose_index
file: /home/john/debian-handbook/containers/compose/index.html
The resolved model adds what the file left implicit: a default network
named for the project, prefixed names for both volumes, absolute paths for
the secret and config sources, and mode: 292 - the octal form of the
0444 permission on the mounted page. docker compose config is the
habit worth forming: it parses and validates the file without touching
Docker, so a YAML error surfaces before any container starts.
25.5.3. Running and Migrating a Small Compose Workload
| Subcommand | Effect |
|---|---|
docker compose up -d |
create the project's objects and start its services detached |
docker compose ps |
list the project's containers and their health |
docker compose exec SVC CMD |
run a command inside a running service container (-T for noninteractive use) |
docker compose down |
stop and remove the containers and network |
docker compose down -v |
also remove the project's named volumes - a data-loss operation for the volumes' contents |
Bring the project up. On ctr1, as john:
$ cd ~/debian-handbook/containers/compose && docker compose up -d
Network handbook-compose_default Creating
Network handbook-compose_default Created
Volume "handbook-compose_webcache" Creating
Volume "handbook-compose_webcache" Created
Volume "handbook-compose_cachedata" Creating
Volume "handbook-compose_cachedata" Created
Container handbook-compose-web-1 Creating
Container handbook-compose-cache-1 Creating
time="2026-11-23T12:08:29Z" level=warning msg="config `uid`, `gid` and `mode` are not supported, they will be ignored"
Container handbook-compose-cache-1 Created
Container handbook-compose-web-1 Created
Container handbook-compose-cache-1 Starting
Container handbook-compose-web-1 Starting
Container handbook-compose-cache-1 Started
Container handbook-compose-web-1 Started
The progress lines name each object as Compose creates it, in dependency
order: network, volumes, then both containers. The warning comes from the
configs entry: this Compose version does not apply uid, gid, and
mode to file-backed configs and says so - the page still mounts, with
the mode left to the filesystem. Check the running state. On ctr1, as
john:
$ cd ~/debian-handbook/containers/compose && docker compose ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
handbook-compose-cache-1 docker.io/library/redis:7.4-alpine "docker-entrypoint.s…" cache 7 seconds ago Up 2 seconds (health: starting) 6379/tcp
handbook-compose-web-1 docker.io/library/nginx:1.27-alpine "/docker-entrypoint.…" web 7 seconds ago Up 2 seconds (health: starting) 192.168.245.10:8081->80/tcp
Both services report health: starting, the same probe-in-progress state
as Section 25.2.3, and the PORTS column confirms the published mapping.
The client sees the composed page. On ctrclient, as john:
$ curl -sS http://192.168.245.10:8081/
Compose workshop page
The configs mechanism delivered index.html into the nginx document
root, and the secret arrived too. On ctr1, as john:
$ cd ~/debian-handbook/containers/compose && docker compose exec -T web cat /run/secrets/app_secret
compose-example-secret
The -T flag disables the pseudo-terminal that exec would otherwise
allocate; for scripted, noninteractive commands like this one it is the
right form. Exercise the volume-backed service: write a key through the
cache, then force Redis to persist it to its volume. On ctr1, as john:
$ cd ~/debian-handbook/containers/compose && docker compose exec -T cache redis-cli set greeting hello
OK
$ cd ~/debian-handbook/containers/compose && docker compose exec -T cache redis-cli save
OK
Now demonstrate what down does and does not remove. On ctr1, as john:
$ cd ~/debian-handbook/containers/compose && docker compose down
Container handbook-compose-web-1 Stopping
Container handbook-compose-cache-1 Stopping
Container handbook-compose-cache-1 Stopped
Container handbook-compose-cache-1 Removing
Container handbook-compose-web-1 Stopped
Container handbook-compose-web-1 Removing
Container handbook-compose-cache-1 Removed
Container handbook-compose-web-1 Removed
Network handbook-compose_default Removing
Network handbook-compose_default Removed
Containers and network are gone; the two volumes were not touched. Bring the project back and read the key again. On ctr1, as john:
$ cd ~/debian-handbook/containers/compose && docker compose up -d
Network handbook-compose_default Creating
Network handbook-compose_default Created
Container handbook-compose-web-1 Creating
Container handbook-compose-cache-1 Creating
time="2026-11-23T12:08:50Z" level=warning msg="config `uid`, `gid` and `mode` are not supported, they will be ignored"
Container handbook-compose-cache-1 Created
Container handbook-compose-web-1 Created
Container handbook-compose-web-1 Starting
Container handbook-compose-cache-1 Starting
Container handbook-compose-cache-1 Started
Container handbook-compose-web-1 Started
This time no volumes appear in the output - they already exist. On ctr1, as john:
$ cd ~/debian-handbook/containers/compose && docker compose exec -T cache redis-cli get greeting
hello
The value survived a full teardown and rebuild of the service, because
down removes containers, not the project's persistent objects. That is
the migration property Compose users rely on: docker compose down &&
docker compose up -d is a restart; only down -v destroys the data, and
the table above marks it as such. End the exercise with the destructive
form, which this demo can afford. On ctr1, as john:
$ cd ~/debian-handbook/containers/compose && docker compose down -v
Container handbook-compose-cache-1 Stopping
Container handbook-compose-web-1 Stopping
Container handbook-compose-cache-1 Stopped
Container handbook-compose-cache-1 Removing
Container handbook-compose-web-1 Stopped
Container handbook-compose-web-1 Removing
Container handbook-compose-cache-1 Removed
Container handbook-compose-web-1 Removed
Volume handbook-compose_cachedata Removing
Volume handbook-compose_webcache Removing
Network handbook-compose_default Removing
Volume handbook-compose_cachedata Removed
Volume handbook-compose_webcache Removed
Network handbook-compose_default Removed
The same file now runs under Podman. podman-compose translates the
services, networks, volumes, and secrets into plain Podman commands.
On ctr1, as john:
$ cd ~/debian-handbook/containers/compose && podman-compose up -d
Selected output; the command prints each image's pull progress on standard error, then the IDs and names of the two containers it created, in the same form as the earlier Podman pulls. List what it started. On ctr1, as john:
$ podman ps --format '{{.Names}}'
handbook-web
handbook-compose_web_1
handbook-compose_cache_1
Both Compose services run - the underscore naming is podman-compose's, Docker Compose used hyphens - alongside the Quadlet service from Section 25.4. Now the compatibility check that matters. On ctr1, as john:
$ curl -sS http://192.168.245.10:8081/ | head -4
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
The page is nginx's default, not the workshop page: podman-compose 1.3.0
honored the services, volumes, networks, and secrets but did not apply the
Compose configs entry, so the image's own content was served. The secret,
by contrast, did arrive. On ctr1, as john:
$ podman exec handbook-compose_web_1 cat /run/secrets/app_secret
compose-example-secret
This is the migration lesson in one exercise: the two providers agree on the common core of Compose but diverge on features, and the divergence is per-feature, not per-provider. Test your own file's features under the provider you intend to use, feature by feature, before relying on the migration. Clean up the Podman copy of the project. On ctr1, as john:
$ cd ~/debian-handbook/containers/compose && podman-compose down -v
handbook-compose_web_1
handbook-compose_cache_1
handbook-compose_cache_1
handbook-compose_web_1
handbook-compose_webcache
handbook-compose_cachedata
56684e11358a65114cf468a467a0f71639b87ca941b5ba5648636326d2676b5a
handbook-compose_default
The tool echoes each object as it removes it - containers, both volumes, and the network, with an ID mixed into the names. With both providers' copies removed, the host is back to the Quadlet service alone.
25.5.4. Checking Provider Compatibility and Choosing Compose or Quadlet
Figure 25.4. A decision schematic for the two management models exercised in this chapter, with the compatibility observation from Section 25.5.3 attached to the Compose branch.
The choice is about what owns the lifecycle. Compose owns a project: a
set of services that come up and go down together under one command, with
networks and volumes created and removed alongside them. Quadlet owns a
service: one systemd unit with restart policy, health reporting, boot
startup, and resource limits, managed with the same systemctl vocabulary
as every other service on the host.
| Need | Better fit |
|---|---|
| Several cooperating services for local development or a shared demo | Compose |
An existing compose.yaml that upstream ships |
Compose, after a per-feature provider check |
| One long-running service that must survive reboots and crashes | Quadlet |
| Rootless service owned by a user account | Quadlet user unit plus linger |
| Kubernetes manifests already written | Quadlet .kube units or cluster tooling (Chapter 40) |
Two compatibility facts from this chapter's exercises should drive the
provider check. First, the Docker CLI is usable against rootless Podman
through the API socket (Section 25.5.1), so "our scripts call docker" is
not by itself a reason to run the Docker daemon. Second, Compose providers
diverge per feature - podman-compose 1.3.0 skipped the configs entry
that Docker Compose 2.26.1 applied - so the file, not the marketing, is
what needs testing. A third fact belongs to planning rather than testing:
when a workload outgrows one host, the Compose file is a local-development
artifact, and the durable path is a cluster, which
Chapter 40 covers.