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
+53-3Lines changed: 53 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,54 @@ 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. It is not fully compatible with Docker Compose. To run this deployment with Podman, you may need to use `podman compose` or podman-compose, depending on your environment and configuration.
16
+
17
+
Podman uses a different architecture (for example, pods and rootless containers). As a result, networking, volume mounts, and service behavior may differ from Docker Compose. This deployment has been tested with Docker Compose. If you use Podman, verify that the cluster operates as expected before using it in production.
18
+
19
+
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:
20
+
21
+
* 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).
22
+
23
+
* Commands: Replace `docker compose` with `podman compose` or `podman-compose`, and `docker exec` with `podman exec`. Examples:
24
+
25
+
* Start node 1: `podman compose up -d pxc1` (or `podman-compose up -d pxc1`)
26
+
27
+
* Start other nodes: `podman compose up -d pxc2 pxc3`
28
+
29
+
* Validate: `podman exec -it pxc1 mysql -uroot -p${MYSQL_ROOT_PASSWORD} -e "SHOW STATUS LIKE 'wsrep_cluster_size';"`
30
+
31
+
* 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.
32
+
33
+
* 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.
34
+
35
+
### Handling rootless permissions (most important for Podman)
36
+
37
+
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.
46
+
47
+
### podman-compose vs docker-compose
48
+
49
+
* If you use podman-compose (the Python tool): It reads the directory structure and `.env` file the same way Docker does.
50
+
51
+
* 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.
52
+
53
+
### Network considerations
54
+
55
+
PXC uses specific ports for cluster communication (4567, 4568, 4444). Podman uses different networking (netavark or CNI). If nodes cannot find each other:
56
+
57
+
* Keep using a named network in the Compose file (for example, `pxcnet`) so Podman can resolve container names (pxc1, pxc2, pxc3).
58
+
59
+
* If problems persist, try setting `network_mode: slirp4netns` on the services, or run the stack rootful to use the default bridge.
60
+
13
61
The following procedure describes setting up a simple 3-node cluster
14
62
for evaluation and testing purposes. Do not use these instructions in a
15
63
production environment because the MySQL certificates generated in this
@@ -19,7 +67,7 @@ In a production environment, you should generate and store the certificates to b
19
67
20
68
## Prerequisites
21
69
22
-
* Docker and Docker Compose installed
70
+
* 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
71
24
72
* At least 3 GB of memory per container
25
73
@@ -207,23 +255,25 @@ This structure helps manage configuration files, TLS/SSL certificates, and setup
207
255
```shell
208
256
docker compose up -d pxc1
209
257
```
258
+
(With Podman: `podman compose up -d pxc1` or `podman-compose up -d pxc1`.)
210
259
211
260
Then, start the remaining nodes:
212
261
213
262
214
263
```shell
215
264
docker compose up -d pxc2 pxc3
216
265
```
266
+
(With Podman: `podman compose up -d pxc2 pxc3` or `podman-compose up -d pxc2 pxc3`.)
217
267
218
268
7. Validate the Cluster
219
269
220
-
Check the status of each node:
270
+
Check the status of each node. Exact commands (run from the host; use the same password as in your `.env`):
221
271
222
-
223
272
```shell
224
273
docker exec -it pxc1 mysql -uroot -p${MYSQL_ROOT_PASSWORD} -e "SHOW STATUS LIKE 'wsrep_cluster_size';"
225
274
docker exec -it pxc2 mysql -uroot -p${MYSQL_ROOT_PASSWORD} -e "SHOW STATUS LIKE 'wsrep_cluster_status';"
226
275
```
276
+
(With Podman: use `podman exec` instead of `docker exec`.)
227
277
228
278
You should see all three nodes joined and synchronized.
0 commit comments