Skip to content

Commit bddc7c0

Browse files
committed
PXC-5141 - [DOCS] - [feedback] It doesn't work with podman compose 8.4
modified: docs/docker-compose.md
1 parent a94d125 commit bddc7c0

File tree

1 file changed

+57
-3
lines changed

1 file changed

+57
-3
lines changed

docs/docker-compose.md

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,58 @@ We gather [Telemetry data](telemetry.md) in the Percona packages and Docker imag
1010

1111
This guide shows you how to deploy a three-node Percona XtraDB Cluster 8.4 using Docker Compose. You generate SSL certificates on the first node and copy them to the other two nodes to enable secure communication.
1212

13+
## Using Podman instead of Docker
14+
15+
Podman can be used as an alternative to Docker because it supports the same container images. However, it is not fully compatible with Docker Compose.
16+
17+
To run this deployment with Podman, you may need to use tools such as podman compose, podman-compose, or a configured Docker Compose compatibility layer, depending on your environment.
18+
19+
Podman uses a different architecture (for example, pods and rootless containers), so networking, volume mounts, and service behavior may differ from Docker Compose.
20+
21+
This deployment is designed and tested with Docker Compose. Podman support is not guaranteed. If you use Podman, verify that the cluster operates correctly before using it beyond testing or experimentation.
22+
23+
You can use the same Compose file and workflow with [Podman](https://podman.io/). Use Podman 4.1 or later; the built-in `podman compose` subcommand requires 4.1 or newer. With older Podman, use the separate podman-compose tool. Then:
24+
25+
* Prerequisites: Podman and Podman Compose (for example, `pip install podman-compose` or your distro’s package) if you are not using built-in `podman compose`. For rootless Podman, ensure the user has enough resources (for example, `sysctl user.max_user_namespaces` and subuid/subgid ranges).
26+
27+
* Commands: Replace `docker compose` with `podman compose` or `podman-compose`, and `docker exec` with `podman exec`. Examples:
28+
29+
* Start node 1: `podman compose up -d pxc1` (or `podman-compose up -d pxc1`)
30+
31+
* Start other nodes: `podman compose up -d pxc2 pxc3`
32+
33+
* Validate: `podman exec -it pxc1 mysql -uroot -p${MYSQL_ROOT_PASSWORD} -e "SHOW STATUS LIKE 'wsrep_cluster_size';"`
34+
35+
* Directory structure: The same layout (`pxc-cluster/` with `certs/`, `conf.d/`, and `init/`) works with Podman. Run `podman compose` from the project directory (for example, `pxc-cluster/`) so the relative volume paths in the Compose file resolve correctly.
36+
37+
* Compose file: The `docker-compose.yml` in this guide works as-is with Podman; the `bridge` network and volume mounts are supported. For rootless Podman, see the volume mount options below.
38+
39+
### Handling rootless permissions (most important for Podman)
40+
41+
In Docker, the daemon runs as root and can override file permissions. In Podman, if you run as a normal user, the MySQL process inside the container (usually UID 1001 or 999) may not have permission to read the files you created on the host. Ensure the files are readable by the container. On systems with SELinux, use the `:Z` (private) or `:z` (shared) mount option so Podman relabels the volume for the container. In your `docker-compose.yml`, use:
42+
43+
```text
44+
volumes:
45+
- ./certs:/etc/mysql/certs:ro,Z
46+
- ./conf.d:/etc/percona-xtradb-cluster.conf.d:ro,Z
47+
```
48+
49+
Apply the same volume options to every service (pxc1, pxc2, pxc3). Without `:Z` or `:z`, the container may fail to read certs or config when running rootless on SELinux.
50+
51+
### podman-compose vs docker-compose
52+
53+
* If you use podman-compose (the Python tool): It reads the directory structure and `.env` file the same way Docker does.
54+
55+
* If you use docker-compose with the Podman socket: This is often more stable for PXC. Set `DOCKER_HOST` to point at the Podman socket (for example, `unix:///run/user/$(id -u)/podman/podman.sock`) so `docker compose` talks to Podman.
56+
57+
### Network considerations
58+
59+
PXC uses specific ports for cluster communication (4567, 4568, 4444). Podman uses different networking (netavark or CNI). If nodes cannot find each other:
60+
61+
* Keep using a named network in the Compose file (for example, `pxcnet`) so Podman can resolve container names (pxc1, pxc2, pxc3).
62+
63+
* If problems persist, try setting `network_mode: slirp4netns` on the services, or run the stack rootful to use the default bridge.
64+
1365
The following procedure describes setting up a simple 3-node cluster
1466
for evaluation and testing purposes. Do not use these instructions in a
1567
production environment because the MySQL certificates generated in this
@@ -19,7 +71,7 @@ In a production environment, you should generate and store the certificates to b
1971

2072
## Prerequisites
2173

22-
* Docker and Docker Compose installed
74+
* Docker and Docker Compose installed (or Podman 4.1 or later and Podman Compose; see [Using Podman instead of Docker](#using-podman-instead-of-docker))
2375

2476
* At least 3 GB of memory per container
2577

@@ -207,23 +259,25 @@ This structure helps manage configuration files, TLS/SSL certificates, and setup
207259
```shell
208260
docker compose up -d pxc1
209261
```
262+
(With Podman: `podman compose up -d pxc1` or `podman-compose up -d pxc1`.)
210263
211264
Then, start the remaining nodes:
212265
213266
214267
```shell
215268
docker compose up -d pxc2 pxc3
216269
```
270+
(With Podman: `podman compose up -d pxc2 pxc3` or `podman-compose up -d pxc2 pxc3`.)
217271
218272
7. Validate the Cluster
219273
220-
Check the status of each node:
274+
Check the status of each node. Exact commands (run from the host; use the same password as in your `.env`):
221275
222-
223276
```shell
224277
docker exec -it pxc1 mysql -uroot -p${MYSQL_ROOT_PASSWORD} -e "SHOW STATUS LIKE 'wsrep_cluster_size';"
225278
docker exec -it pxc2 mysql -uroot -p${MYSQL_ROOT_PASSWORD} -e "SHOW STATUS LIKE 'wsrep_cluster_status';"
226279
```
280+
(With Podman: use `podman exec` instead of `docker exec`.)
227281
228282
You should see all three nodes joined and synchronized.
229283

0 commit comments

Comments
 (0)