mirror of
https://github.com/bitnami/containers.git
synced 2026-10-19 01:56:53 +02:00
[bitnami/mariadb-galera] Release 12.2.2-debian-12-r2 (#91360)
Signed-off-by: Bitnami Bot <bitnami.bot@broadcom.com>
This commit is contained in:
@@ -7,7 +7,7 @@ ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith"
|
||||
ARG TARGETARCH
|
||||
|
||||
LABEL org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \
|
||||
org.opencontainers.image.created="2026-02-19T02:54:30Z" \
|
||||
org.opencontainers.image.created="2026-03-06T14:54:15Z" \
|
||||
org.opencontainers.image.description="Application packaged by Broadcom, Inc." \
|
||||
org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/mariadb-galera/README.md" \
|
||||
org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/mariadb-galera" \
|
||||
@@ -28,8 +28,8 @@ RUN --mount=type=secret,id=downloads_url,env=SECRET_DOWNLOADS_URL \
|
||||
DOWNLOADS_URL=${SECRET_DOWNLOADS_URL:-${DOWNLOADS_URL}} ; \
|
||||
mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ || exit 1 ; \
|
||||
COMPONENTS=( \
|
||||
"ini-file-1.4.9-7-linux-${OS_ARCH}-debian-12" \
|
||||
"mariadb-galera-12.2.2-0-linux-${OS_ARCH}-debian-12" \
|
||||
"ini-file-1.4.9-8-linux-${OS_ARCH}-debian-12" \
|
||||
"mariadb-galera-12.2.2-1-linux-${OS_ARCH}-debian-12" \
|
||||
) ; \
|
||||
for COMPONENT in "${COMPONENTS[@]}"; do \
|
||||
if [ ! -f "${COMPONENT}.tar.gz" ]; then \
|
||||
@@ -51,7 +51,7 @@ COPY rootfs /
|
||||
RUN /opt/bitnami/scripts/mariadb-galera/postunpack.sh
|
||||
ENV APP_VERSION="12.2.2" \
|
||||
BITNAMI_APP_NAME="mariadb-galera" \
|
||||
IMAGE_REVISION="1" \
|
||||
IMAGE_REVISION="2" \
|
||||
PATH="/opt/bitnami/common/bin:/opt/bitnami/mariadb/bin:/opt/bitnami/mariadb/sbin:/opt/bitnami/common/sbin:$PATH"
|
||||
|
||||
EXPOSE 3306 4444 4567 4568
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
# Bitnami Secure Image for MariaDB Galera
|
||||
|
||||
## What is MariaDB Galera?
|
||||
|
||||
> MariaDB Galera is a multi-primary database cluster solution for synchronous replication and high availability.
|
||||
|
||||
[Overview of MariaDB Galera](https://mariadb.org/)
|
||||
@@ -44,7 +42,7 @@ Non-root container images add an extra layer of security and are generally recom
|
||||
|
||||
## Supported tags and respective `Dockerfile` links
|
||||
|
||||
> NOTE: Debian 9 and Oracle Linux 7 images have been deprecated in favor of Debian 10 images. Bitnami will not longer publish new Docker images based on Debian 9 or Oracle Linux 7.
|
||||
> **NOTE** Debian 9 and Oracle Linux 7 images have been deprecated in favor of Debian 10 images. Bitnami will not longer publish new Docker images based on Debian 9 or Oracle Linux 7.
|
||||
|
||||
Learn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags [in our documentation page](https://techdocs.broadcom.com/us/en/vmware-tanzu/application-catalog/tanzu-application-catalog/services/tac-doc/apps-tutorials-understand-rolling-tags-containers-index.html).
|
||||
|
||||
@@ -70,106 +68,30 @@ cd bitnami/APP/VERSION/OPERATING-SYSTEM
|
||||
docker build -t bitnami/APP:latest .
|
||||
```
|
||||
|
||||
## Using `docker-compose.yaml`
|
||||
|
||||
Please be aware this file has not undergone internal testing. Consequently, we advise its use exclusively for development or testing purposes. For production-ready deployments, we highly recommend utilizing its associated [Bitnami Helm chart](https://github.com/bitnami/charts/tree/main/bitnami/mariadb-galera).
|
||||
|
||||
## Persisting your database
|
||||
|
||||
If you remove the container all your data will be lost, and the next time you run the image the database will be reinitialized. To avoid this loss of data, you should mount a volume that will persist even after the container is removed.
|
||||
|
||||
For persistence you should mount a directory at the `/bitnami/mariadb` path. If the mounted directory is empty, it will be initialized on the first run.
|
||||
|
||||
```console
|
||||
docker run \
|
||||
-e ALLOW_EMPTY_PASSWORD=yes \
|
||||
-v /path/to/mariadb-persistence:/bitnami/mariadb \
|
||||
bitnami/mariadb-galera:latest
|
||||
```
|
||||
|
||||
or by modifying the [`docker-compose.yml`](https://github.com/bitnami/containers/blob/main/bitnami/mariadb-galera/docker-compose.yml) file present in this repository:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
mariadb:
|
||||
...
|
||||
volumes:
|
||||
- /path/to/mariadb-persistence:/bitnami/mariadb
|
||||
...
|
||||
```
|
||||
|
||||
## Connecting to other containers
|
||||
|
||||
Using [Docker container networking](https://docs.docker.com/engine/userguide/networking/), a MariaDB server running inside a container can easily be accessed by your application containers.
|
||||
|
||||
Containers attached to the same network can communicate with each other using the container name as the hostname.
|
||||
|
||||
### Using the Command Line
|
||||
|
||||
In this example, we will create a MariaDB client instance that will connect to the server instance that is running on the same docker network as the client.
|
||||
|
||||
#### Step 1: Create a network
|
||||
|
||||
```console
|
||||
docker network create app-tier --driver bridge
|
||||
```
|
||||
|
||||
#### Step 2: Launch the MariaDB server instance
|
||||
|
||||
Use the `--network app-tier` argument to the `docker run` command to attach the MariaDB container to the `app-tier` network.
|
||||
|
||||
```console
|
||||
docker run -d --name mariadb-galera \
|
||||
-e ALLOW_EMPTY_PASSWORD=yes \
|
||||
--network app-tier \
|
||||
bitnami/mariadb-galera:latest
|
||||
```
|
||||
|
||||
#### Step 3: Launch your MariaDB client instance
|
||||
|
||||
Finally we create a new container instance to launch the MariaDB client and connect to the server created in the previous step:
|
||||
|
||||
```console
|
||||
docker run -it --rm \
|
||||
--network app-tier \
|
||||
bitnami/mariadb-galera:latest mysql -h mariadb-galera -u root
|
||||
```
|
||||
|
||||
### Using a Docker Compose file
|
||||
|
||||
When not specified, Docker Compose automatically sets up a new network and attaches all deployed services to that network. However, we will explicitly define a new `bridge` network named `app-tier`. In this example we assume that you want to connect to the MariaDB server from your own custom application image which is identified in the following snippet by the service name `myapp`.
|
||||
|
||||
```yaml
|
||||
version: '2'
|
||||
|
||||
networks:
|
||||
app-tier:
|
||||
driver: bridge
|
||||
|
||||
services:
|
||||
mariadb-galera:
|
||||
image: bitnami/mariadb-galera:latest
|
||||
environment:
|
||||
- ALLOW_EMPTY_PASSWORD=yes
|
||||
networks:
|
||||
- app-tier
|
||||
myapp:
|
||||
image: YOUR_APPLICATION_IMAGE
|
||||
networks:
|
||||
- app-tier
|
||||
```
|
||||
|
||||
> **IMPORTANT**:
|
||||
>
|
||||
> 1. Please update the `YOUR_APPLICATION_IMAGE` placeholder in the above snippet with your application image
|
||||
> 2. In your application container, use the hostname `mariadb` to connect to the MariaDB server
|
||||
|
||||
Launch the containers using:
|
||||
|
||||
```console
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
The following section describes the supported environment variables
|
||||
|
||||
### Environment variables
|
||||
|
||||
The following tables list the main variables you can set.
|
||||
|
||||
#### Customizable environment variables
|
||||
|
||||
| Name | Description | Default Value |
|
||||
@@ -268,7 +190,7 @@ In order to have your custom files inside the docker image you can mount them as
|
||||
|
||||
Take into account those scripts are treated differently depending on the extension. While the `.sh` scripts are executed in all the nodes; the `.sql` and `.sql.gz` scripts are only executed in the bootstrap node. The reason behind this differentiation is that the `.sh` scripts allow adding conditions to determine what is the node running the script, while these conditions can't be set using `.sql` nor `sql.gz` files. This way it is possible to cover different use cases depending on their needs.
|
||||
|
||||
> NOTE: If you are importing large databases, it is recommended to import them as `.sql` instead of `.sql.gz`, as the latter one needs to be decompressed on the fly and not allowing for additional optimizations to import large files.
|
||||
> **NOTE** If you are importing large databases, it is recommended to import them as `.sql` instead of `.sql.gz`, as the latter one needs to be decompressed on the fly and not allowing for additional optimizations to import large files.
|
||||
|
||||
### Passing extra command-line flags to mysqld startup
|
||||
|
||||
@@ -276,24 +198,6 @@ Passing extra command-line flags to the mysqld service command is possible throu
|
||||
|
||||
- `MARIADB_EXTRA_FLAGS`: Flags to be appended to the startup command. No defaults
|
||||
|
||||
```console
|
||||
docker run --name mariadb \
|
||||
-e ALLOW_EMPTY_PASSWORD=yes \
|
||||
-e MARIADB_EXTRA_FLAGS='--max-connect-errors=1000 --max_connections=155' \
|
||||
bitnami/mariadb-galera:latest
|
||||
```
|
||||
|
||||
or by modifying the [`docker-compose.yml`](https://github.com/bitnami/containers/blob/main/bitnami/mariadb-galera/docker-compose.yml) file present in this repository:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
mariadb:
|
||||
...
|
||||
environment:
|
||||
- MARIADB_EXTRA_FLAGS=--max-connect-errors=1000 --max_connections=155
|
||||
...
|
||||
```
|
||||
|
||||
### Setting character set and collation
|
||||
|
||||
It is possible to configure the character set and collation used by default by the database with the following environment variables:
|
||||
@@ -310,96 +214,20 @@ The root user and password can easily be setup with the Bitnami MariaDB Galera D
|
||||
|
||||
Passing the `MARIADB_ROOT_PASSWORD` environment variable when running the image for the first time will set the password of the `MARIADB_ROOT_USER` user to the value of `MARIADB_ROOT_PASSWORD`.
|
||||
|
||||
```console
|
||||
docker run --name mariadb \
|
||||
-e MARIADB_ROOT_PASSWORD=password123 \
|
||||
bitnami/mariadb-galera:latest
|
||||
```
|
||||
|
||||
or by modifying the [`docker-compose.yml`](https://github.com/bitnami/containers/blob/main/bitnami/mariadb-galera/docker-compose.yml) file present in this repository:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
mariadb:
|
||||
...
|
||||
environment:
|
||||
- MARIADB_ROOT_PASSWORD=password123
|
||||
...
|
||||
```
|
||||
|
||||
**Warning** The `MARIADB_ROOT_USER` user is always created with remote access. It's suggested that the `MARIADB_ROOT_PASSWORD` env variable is always specified to set a password for the `MARIADB_ROOT_USER` user. In case you want to allow the `MARIADB_ROOT_USER` user to access the database without a password set the environment variable `ALLOW_EMPTY_PASSWORD=yes`. **This is suggested only for development or testing environments**.
|
||||
|
||||
### Allowing empty passwords
|
||||
|
||||
By default the MariaDB Galera image expects all the available passwords to be set. In order to allow empty passwords, it is necessary to set the `ALLOW_EMPTY_PASSWORD=yes` env variable. This env variable is only suggested for testing or development purposes. We strongly recommend specifying the `MARIADB_ROOT_PASSWORD` for any other scenario.
|
||||
|
||||
```console
|
||||
docker run --name mariadb \
|
||||
-e ALLOW_EMPTY_PASSWORD=yes \
|
||||
bitnami/mariadb-galera:latest
|
||||
```
|
||||
|
||||
or by modifying the [`docker-compose.yml`](https://github.com/bitnami/containers/blob/main/bitnami/mariadb-galera/docker-compose.yml) file present in this repository:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
mariadb:
|
||||
...
|
||||
environment:
|
||||
- ALLOW_EMPTY_PASSWORD=yes
|
||||
...
|
||||
```
|
||||
|
||||
### Creating a database on first run
|
||||
|
||||
By passing the `MARIADB_DATABASE` environment variable when running the image for the first time, a database will be created. This is useful if your application requires that a database already exists, saving you from having to manually create the database using the MySQL client.
|
||||
|
||||
```console
|
||||
docker run --name mariadb \
|
||||
-e ALLOW_EMPTY_PASSWORD=yes \
|
||||
-e MARIADB_DATABASE=my_database \
|
||||
bitnami/mariadb-galera:latest
|
||||
```
|
||||
|
||||
or by modifying the [`docker-compose.yml`](https://github.com/bitnami/containers/blob/main/bitnami/mariadb-galera/docker-compose.yml) file present in this repository:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
mariadb:
|
||||
...
|
||||
environment:
|
||||
- ALLOW_EMPTY_PASSWORD=yes
|
||||
- MARIADB_DATABASE=my_database
|
||||
...
|
||||
```
|
||||
|
||||
### Creating a database user on first run
|
||||
|
||||
You can create a restricted database user that only has permissions for the database created with the [`MARIADB_DATABASE`](#creating-a-database-on-first-run) environment variable. To do this, provide the `MARIADB_USER` environment variable and to set a password for the database user provide the `MARIADB_PASSWORD` variable.
|
||||
|
||||
```console
|
||||
docker run --name mariadb \
|
||||
-e ALLOW_EMPTY_PASSWORD=yes \
|
||||
-e MARIADB_USER=my_user \
|
||||
-e MARIADB_PASSWORD=my_password \
|
||||
-e MARIADB_DATABASE=my_database \
|
||||
bitnami/mariadb-galera:latest
|
||||
```
|
||||
|
||||
or by modifying the [`docker-compose.yml`](https://github.com/bitnami/containers/blob/main/bitnami/mariadb-galera/docker-compose.yml) file present in this repository:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
mariadb:
|
||||
...
|
||||
environment:
|
||||
- ALLOW_EMPTY_PASSWORD=yes
|
||||
- MARIADB_USER=my_user
|
||||
- MARIADB_PASSWORD=my_password
|
||||
- MARIADB_DATABASE=my_database
|
||||
...
|
||||
```
|
||||
|
||||
**Note!** The `root` user will be created with remote access and without a password if `ALLOW_EMPTY_PASSWORD` is enabled. Please provide the `MARIADB_ROOT_PASSWORD` env variable instead if you want to set a password for the `root` user.
|
||||
|
||||
### Enabling LDAP support
|
||||
@@ -418,46 +246,6 @@ LDAP configuration parameters must be specified if you wish to enable LDAP suppo
|
||||
- `LDAP_SEARCH_MAP`: LDAP custom search attribute to be looked up on posix users (Optional). No defaults.
|
||||
- `LDAP_TLS_REQCERT`: LDAP TLS check on server certificates (Optional). No defaults.
|
||||
|
||||
#### Step 1: Start MariaDB Galera with LDAP support
|
||||
|
||||
```console
|
||||
docker run --name mariadb \
|
||||
-e ALLOW_EMPTY_PASSWORD=yes \
|
||||
-e MARIADB_ENABLE_LDAP=yes \
|
||||
-e LDAP_URI=ldap://ldap.example.org/ \
|
||||
-e LDAP_BASE=dc=example,dc=org \
|
||||
-e LDAP_BIND_DN=cn=admin,dc=example,dc=org \
|
||||
-e LDAP_BIND_PASSWORD=admin \
|
||||
bitnami/mariadb-galera:latest
|
||||
```
|
||||
|
||||
or by modifying the [`docker-compose.yml`](https://github.com/bitnami/containers/blob/main/bitnami/mariadb-galera/docker-compose.yml) file present in this repository:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
mariadb:
|
||||
...
|
||||
environment:
|
||||
- MARIADB_ENABLE_LDAP=yes
|
||||
- LDAP_URI=ldap://ldap.example.org/
|
||||
- LDAP_BASE=dc=example,dc=org
|
||||
- LDAP_BIND_DN=cn=admin,dc=example,dc=org
|
||||
- LDAP_BIND_PASSWORD=admin
|
||||
...
|
||||
```
|
||||
|
||||
**Note**: The LDAP connection parameters can be fine tuned by specifying the `LDAP_BASE_LOOKUP`, `LDAP_SCOPE` and `LDAP_TLS_REQCERT` environment variables.
|
||||
|
||||
#### Step 2: Configure PAM authenticated LDAP users
|
||||
|
||||
Login to the MariaDB server using the `root` credentials and configure the LDAP users you wish to have access to the MariaDB Galera cluster.
|
||||
|
||||
```console
|
||||
mysql -uroot -e "CREATE USER 'foo'@'localhost' IDENTIFIED VIA pam USING 'mariadb';"
|
||||
```
|
||||
|
||||
The above command configures the database user `foo` to authenticate itself with the LDAP credentials to log in to MariaDB Galera server.
|
||||
|
||||
Refer to the [OpenLDAP Administrator's Guide](https://www.openldap.org/doc/admin24/) to learn more about LDAP.
|
||||
|
||||
### Securing Galera cluster traffic
|
||||
@@ -469,32 +257,6 @@ To secure the traffic you must mount the certificates files and set the followin
|
||||
- `MARIADB_TLS_KEY_FILE`: File containing the key for certificate. No defaults.
|
||||
- `MARIADB_TLS_CA_FILE`: File containing the CA of the certificate. No defaults.
|
||||
|
||||
#### Start MariaDB Galera with secured traffic
|
||||
|
||||
```console
|
||||
docker run --name mariadb \
|
||||
-v /path/to/cert.pem:/bitnami/mariadb/certs/cert.pem:ro
|
||||
-v /path/to/key.pem:/bitnami/mariadb/certs/key.pem:ro
|
||||
-v /path/to/ca.pem:/bitnami/mariadb/certs/ca.pem:ro
|
||||
-e ALLOW_EMPTY_PASSWORD=yes \
|
||||
-e MARIADB_ENABLE_TLS=yes \
|
||||
-e MARIADB_TLS_CERT_FILE=/bitnami/mariadb/certs/cert.pem \
|
||||
-e MARIADB_TLS_KEY_FILE=/bitnami/mariadb/certs/key.pem \
|
||||
-e MARIADB_TLS_CA_FILE=/bitnami/mariadb/certs/ca.pem \
|
||||
bitnami/mariadb-galera:latest
|
||||
```
|
||||
|
||||
#### Connecting over TLS
|
||||
|
||||
To connect to the server using TLS you need to mount the CA certificate file and start the client using the `--ssl-ca` parameter
|
||||
|
||||
```console
|
||||
docker run -it --rm \
|
||||
-v /path/to/ca.pem:/bitnami/mariadb/certs/ca.pem:ro \
|
||||
--network app-tier \
|
||||
bitnami/mariadb-galera:latest mysql -h mariadb-galera -u root --ssl-ca=/bitnami/mariadb/certs/ca.pem
|
||||
```
|
||||
|
||||
### Setting up a multi-master cluster
|
||||
|
||||
A **zero downtime** MariaDB Galera [replication](https://dev.mysql.com/doc/refman/5.7/en/server-option-variable-reference.html) cluster can easily be setup with the Bitnami MariaDB Galera Docker image by starting additional MariaDB Galera nodes. The following environment variables are available to configure the cluster:
|
||||
@@ -512,104 +274,16 @@ In a MariaDB Galera cluster the first node should be a bootstrap node (started w
|
||||
|
||||
MariaDB Galera cluster requires every node can connect to each other. If you run the MariaDB Galera nodes in isolated networks (for example, traditional Docker `bridge` networks on different hosts without Kubernetes), you must make sure every node knows its connectable public IP address (the IP of each host). You should add extra flags to MARIADB_EXTRA_FLAGS `--wsrep_provider_options=ist.recv_addr=<PUBLIC_IP>:4568;ist.recv_bind=0.0.0.0:4568 --wsrep_node_incoming_address=<PUBLIC_IP> --wsrep_sst_receive_address=<PUBLIC_IP>` and publish all MariaDB Galera ports to host by `-p 3306:3306,4444:4444,4567:4567,4568:4568`. Another choice is using the Docker `host` network which makes every node can connect to each other without extra flags.
|
||||
|
||||
#### Step 1: Bootstrap the cluster
|
||||
|
||||
The first step is to start the MariaDB Galera bootstrap node.
|
||||
|
||||
```console
|
||||
docker run -d --name mariadb-galera-0 \
|
||||
-e MARIADB_GALERA_CLUSTER_NAME=my_galera \
|
||||
-e MARIADB_GALERA_MARIABACKUP_USER=my_mariabackup_user \
|
||||
-e MARIADB_GALERA_MARIABACKUP_PASSWORD=my_mariabackup_password \
|
||||
-e MARIADB_ROOT_PASSWORD=my_root_password \
|
||||
-e MARIADB_GALERA_CLUSTER_BOOTSTRAP=yes \
|
||||
-e MARIADB_USER=my_user \
|
||||
-e MARIADB_PASSWORD=my_password \
|
||||
-e MARIADB_DATABASE=my_database \
|
||||
-e MARIADB_REPLICATION_USER=my_replication_user \
|
||||
-e MARIADB_REPLICATION_PASSWORD=my_replication_password \
|
||||
bitnami/mariadb-galera:latest
|
||||
```
|
||||
|
||||
In the above command the container is configured as the bootstrap node by specifying the `MARIADB_GALERA_CLUSTER_BOOTSTRAP` parameter. The SST user is specified using the `MARIADB_GALERA_MARIABACKUP_USER` and `MARIADB_GALERA_MARIABACKUP_PASSWORD` parameters and a cluster name is specified using the `MARIADB_GALERA_CLUSTER_NAME` parameter.
|
||||
|
||||
#### Step 2: Add nodes to the cluster
|
||||
|
||||
Next we add a new node to the cluster.
|
||||
|
||||
```console
|
||||
docker run -d --name mariadb-galera-1 --link mariadb-galera-0:mariadb-galera \
|
||||
-e MARIADB_GALERA_CLUSTER_NAME=my_galera \
|
||||
-e MARIADB_GALERA_CLUSTER_ADDRESS=gcomm://mariadb-galera:4567,0.0.0.0:4567 \
|
||||
-e MARIADB_GALERA_MARIABACKUP_USER=my_mariabackup_user \
|
||||
-e MARIADB_GALERA_MARIABACKUP_PASSWORD=my_mariabackup_password \
|
||||
-e MARIADB_ROOT_PASSWORD=my_root_password \
|
||||
-e MARIADB_REPLICATION_USER=my_replication_user \
|
||||
-e MARIADB_REPLICATION_PASSWORD=my_replication_password \
|
||||
bitnami/mariadb-galera:latest
|
||||
```
|
||||
|
||||
In the above command a new node is created and configured to join the bootstrapped MariaDB Galera cluster by specifying the `MARIADB_GALERA_CLUSTER_ADDRESS` parameter. The `MARIADB_GALERA_CLUSTER_NAME`, `MARIADB_GALERA_MARIABACKUP_USER` and `MARIADB_GALERA_MARIABACKUP_PASSWORD` are also specified for the Snapshot State Transfer (SST).
|
||||
|
||||
You now have a two node MariaDB Galera cluster up and running. Write to any node of the cluster are automatically propagated to every node. You can scale the cluster by adding/removing slaves without incurring any downtime.
|
||||
|
||||
> **Important**: If you need to stop the MariaDB Galera cluster, ensure you stop the bootstrap node only after you have stopped all other nodes in the cluster. This ensure you do not lose any write that may have occurred while the nodes were being stopped.
|
||||
|
||||
### Slow filesystems
|
||||
|
||||
In some platforms, the filesystem used for persistence could be slow. That could cause the database to take extra time to be ready. If that's the case, you can configure the `MARIADB_INIT_SLEEP_TIME` environment variable to make the initialization script to wait extra time (in seconds) before proceeding with the configuration operations.
|
||||
|
||||
### Configuration file
|
||||
|
||||
The image looks for user-defined configurations in `/opt/bitnami/mariadb/conf/my_custom.cnf`. Create a file named `my_custom.cnf` and mount it at `/opt/bitnami/mariadb/conf/my_custom.cnf`.
|
||||
|
||||
For example, in order to override the `max_allowed_packet` directive:
|
||||
|
||||
#### Step 1: Write your `my_custom.cnf` file with the following content
|
||||
|
||||
```config
|
||||
[mysqld]
|
||||
max_allowed_packet=32M
|
||||
```
|
||||
|
||||
#### Step 2: Run the MariaDB Galera image with the designed volume attached
|
||||
|
||||
```console
|
||||
docker run --name mariadb \
|
||||
-p 3306:3306 \
|
||||
-e ALLOW_EMPTY_PASSWORD=yes \
|
||||
-v /path/to/my_custom.cnf:/opt/bitnami/mariadb/conf/my_custom.cnf:ro \
|
||||
-v /path/to/mariadb-persistence:/bitnami/mariadb \
|
||||
bitnami/mariadb-galera:latest
|
||||
```
|
||||
|
||||
or by modifying the [`docker-compose.yml`](https://github.com/bitnami/containers/blob/main/bitnami/mariadb-galera/docker-compose.yml) file present in this repository:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
mariadb:
|
||||
...
|
||||
volumes:
|
||||
- /path/to/my_custom.cnf:/opt/bitnami/mariadb/conf/my_custom.cnf:ro
|
||||
- /path/to/mariadb-persistence:/bitnami/mariadb
|
||||
...
|
||||
```
|
||||
|
||||
After that, your changes will be taken into account in the server's behaviour.
|
||||
It is possible to mount a configuration file at `/opt/bitnami/mariadb/conf/my.cnf` and overwrite the main configuration file. The image also looks for user-defined configurations in `/opt/bitnami/mariadb/conf/my_custom.cnf`. Create a file named `my_custom.cnf` and mount it at `/opt/bitnami/mariadb/conf/my_custom.cnf`.
|
||||
|
||||
Refer to the [MySQL server option and variable reference guide](https://dev.mysql.com/doc/refman/5.7/en/server-option-variable-reference.html) for the complete list of configuration options.
|
||||
|
||||
### Overwrite the main Configuration file
|
||||
|
||||
It is also possible to use your custom `my.cnf` and overwrite the main configuration file.
|
||||
|
||||
```console
|
||||
docker run --name mariadb \
|
||||
-e ALLOW_EMPTY_PASSWORD=yes \
|
||||
-v /path/to/my.cnf:/opt/bitnami/mariadb/conf/my.cnf:ro \
|
||||
bitnami/mariadb-galera:latest
|
||||
```
|
||||
|
||||
### FIPS configuration in Bitnami Secure Images
|
||||
|
||||
The Bitnami MariaDB Galera Docker image from the [Bitnami Secure Images](https://go-vmware.broadcom.com/contact-us) catalog includes extra features and settings to configure the container with FIPS capabilities. You can configure the next environment variables:
|
||||
@@ -634,55 +308,6 @@ FROM bitnami/mariadb-galera
|
||||
...
|
||||
```
|
||||
|
||||
Here is an example of extending the image with the following modifications:
|
||||
|
||||
- Install the `vim` editor
|
||||
- Modify the MariaDB configuration file
|
||||
- Modify the ports used by MariaDB
|
||||
- Change the user that runs the container
|
||||
|
||||
```Dockerfile
|
||||
FROM bitnami/mariadb-galera
|
||||
|
||||
## Change user to perform privileged actions
|
||||
USER 0
|
||||
## Install 'vim'
|
||||
RUN install_packages vim
|
||||
## Revert to the original non-root user
|
||||
USER 1001
|
||||
|
||||
## modify configuration file.
|
||||
RUN ini-file set --section "mysqld" --key "collation-server" --value "utf8_general_ci" "/opt/bitnami/mariadb-galera/conf/my.cnf"
|
||||
|
||||
## Modify the ports used by MariaDB by default
|
||||
# It is also possible to change these environment variables at runtime
|
||||
ENV MARIADB_PORT_NUMBER=3307
|
||||
EXPOSE 3307
|
||||
|
||||
## Modify the default container user
|
||||
USER 1002
|
||||
```
|
||||
|
||||
Based on the extended image, you can use a Docker Compose file like the one below to add other features:
|
||||
|
||||
- Add a custom configuration
|
||||
|
||||
```yaml
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
mariadb:
|
||||
build: .
|
||||
ports:
|
||||
- 3306:3307
|
||||
volumes:
|
||||
- /path/to/my_custom.cnf:/opt/bitnami/mariadb-galera/conf/my_custom.cnf:ro
|
||||
- data:/bitnami/mariadb-galera/data
|
||||
volumes:
|
||||
data:
|
||||
driver: local
|
||||
```
|
||||
|
||||
## Logging
|
||||
|
||||
The Bitnami MariaDB Galera Docker image sends the container logs to `stdout`. To view the logs:
|
||||
@@ -701,69 +326,6 @@ To increase the verbosity on intialization or add extra debug information, you c
|
||||
|
||||
You can configure the containers [logging driver](https://docs.docker.com/engine/admin/logging/overview/) using the `--log-driver` option if you wish to consume the container logs differently. In the default configuration docker uses the `json-file` driver.
|
||||
|
||||
## Maintenance
|
||||
|
||||
### Upgrade this image
|
||||
|
||||
Bitnami provides up-to-date versions of MariaDB, including security patches, soon after they are made upstream. We recommend that you follow these steps to upgrade your container.
|
||||
|
||||
#### Step 1: Get the updated image
|
||||
|
||||
```console
|
||||
docker pull bitnami/mariadb-galera:latest
|
||||
```
|
||||
|
||||
or if you're using Docker Compose, update the value of the image property to
|
||||
`bitnami/mariadb-galera:latest`.
|
||||
|
||||
#### Step 2: Stop and backup the currently running container
|
||||
|
||||
Stop the currently running container using the command
|
||||
|
||||
```console
|
||||
docker stop mariadb
|
||||
```
|
||||
|
||||
or using Docker Compose:
|
||||
|
||||
```console
|
||||
docker-compose stop mariadb
|
||||
```
|
||||
|
||||
Next, take a snapshot of the persistent volume `/path/to/mariadb-persistence` using:
|
||||
|
||||
```console
|
||||
rsync -a /path/to/mariadb-persistence /path/to/mariadb-persistence.bkp.$(date +%Y%m%d-%H.%M.%S)
|
||||
```
|
||||
|
||||
You can use this snapshot to restore the database state should the upgrade fail.
|
||||
|
||||
#### Step 3: Remove the currently running container
|
||||
|
||||
```console
|
||||
docker rm -v mariadb
|
||||
```
|
||||
|
||||
or using Docker Compose:
|
||||
|
||||
```console
|
||||
docker-compose rm -v mariadb
|
||||
```
|
||||
|
||||
#### Step 4: Run the new image
|
||||
|
||||
Re-create your container from the new image.
|
||||
|
||||
```console
|
||||
docker run --name mariadb bitnami/mariadb-galera:latest
|
||||
```
|
||||
|
||||
or using Docker Compose:
|
||||
|
||||
```console
|
||||
docker-compose up mariadb
|
||||
```
|
||||
|
||||
## Useful Links
|
||||
|
||||
- [Create An AMP Development Environment With Bitnami Containers](https://docs.bitnami.com/containers/how-to/create-amp-environment-containers/)
|
||||
@@ -783,7 +345,7 @@ docker-compose up mariadb
|
||||
|
||||
- The MariaDB Galera container has been migrated to a "non-root" user approach. Previously the container ran as the `root` user, and the MySQL daemon was started as the `mysql` user. From now on, both the container and the MySQL daemon run as user `1001`. You can revert this behavior by changing `USER 1001` to `USER root` in the Dockerfile.
|
||||
- Consequences:
|
||||
- Backwards compatibility is not guaranteed when data is persisted using docker or docker-compose. We highly recommend migrating the data site by creating a backup of the databse, and restoring it on a new MariaDB Galera container. In the link below you can find a guide that explain the whole process:
|
||||
- Backwards compatibility is not guaranteed when data is persisted using docker or docker-compose. We highly recommend migrating the data site by creating a backup of the database, and restoring it on a new MariaDB Galera container. In the link below you can find a guide that explain the whole process:
|
||||
- [Create And Restore MySQL/MariaDB Backups](https://docs.bitnami.com/general/infrastructure/mariadb/administration/backup-restore-mysql-mariadb/)
|
||||
- Environment variables related to LDAP configuration were renamed removing the `MARIADB_` prefix. For instance, to indicate the LDAP URI to use, you must set `LDAP_URI` instead of `MARIADB_LDAP_URI`.
|
||||
|
||||
@@ -792,12 +354,6 @@ docker-compose up mariadb
|
||||
- `10.1.43-centos-7-r78`, `10.2.30-centos-7-r40`, `10.3.21-centos-7-r41`, and `10.4.11-centos-7-r32` are considered the latest images based on CentOS.
|
||||
- Standard supported distros: Debian & OEL.
|
||||
|
||||
## Using `docker-compose.yaml`
|
||||
|
||||
Please be aware this file has not undergone internal testing. Consequently, we advise its use exclusively for development or testing purposes. For production-ready deployments, we highly recommend utilizing its associated [Bitnami Helm chart](https://github.com/bitnami/charts/tree/main/bitnami/mariadb-galera).
|
||||
|
||||
If you detect any issue in the `docker-compose.yaml` file, feel free to report it or contribute with a fix by following our [Contributing Guidelines](https://github.com/bitnami/containers/blob/main/CONTRIBUTING.md).
|
||||
|
||||
## License
|
||||
|
||||
Copyright © 2026 Broadcom. The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
||||
|
||||
Reference in New Issue
Block a user