You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docker-compose.md
+57-3Lines changed: 57 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,58 @@ We gather [Telemetry data](telemetry.md) in the Percona packages and Docker imag
10
10
11
11
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.
12
12
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:
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
+
13
65
The following procedure describes setting up a simple 3-node cluster
14
66
for evaluation and testing purposes. Do not use these instructions in a
15
67
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
19
71
20
72
## Prerequisites
21
73
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))
23
75
24
76
* At least 3 GB of memory per container
25
77
@@ -207,23 +259,25 @@ This structure helps manage configuration files, TLS/SSL certificates, and setup
207
259
```shell
208
260
docker compose up -d pxc1
209
261
```
262
+
(With Podman: `podman compose up -d pxc1` or `podman-compose up -d pxc1`.)
210
263
211
264
Then, start the remaining nodes:
212
265
213
266
214
267
```shell
215
268
docker compose up -d pxc2 pxc3
216
269
```
270
+
(With Podman: `podman compose up -d pxc2 pxc3` or `podman-compose up -d pxc2 pxc3`.)
217
271
218
272
7. Validate the Cluster
219
273
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`):
221
275
222
-
223
276
```shell
224
277
docker exec -it pxc1 mysql -uroot -p${MYSQL_ROOT_PASSWORD} -e "SHOW STATUS LIKE 'wsrep_cluster_size';"
225
278
docker exec -it pxc2 mysql -uroot -p${MYSQL_ROOT_PASSWORD} -e "SHOW STATUS LIKE 'wsrep_cluster_status';"
226
279
```
280
+
(With Podman: use `podman exec` instead of `docker exec`.)
227
281
228
282
You should see all three nodes joined and synchronized.
0 commit comments