# Adding MySQL Client Packages to the Commvault Docker Image

Application container volumes (data and log directories) are shared with Commvault containers. The Commvault containers would need mysqldump, XtraBackup, or other utilities to run backups and restores. So, add the MySQL client packages to the Commvault Docker image.

## Procedure

1. Create a dockerBase file with the following content, replacing the Docker image name and MySQL version as necessary:

       FROM $[image_name:tag]

       #install mysql client 5.7 packages

       RUN yum-config-manager --disable MariaDB; yum -y remove mariadb mariadb-server; yum -y install wget;\

       wget https://repo.mysql.com/$[mysqlversion];\

       yum -y localinstall $[mysqlversion]>;\

       yum -y install mysql;

       #install percona xtrabackup rpm

       ARG XTRABACKUP_VERSION="$[2.4.18-1]"

       RUN set -x && \

       # do special versioning for percona

       ## '$[8.0.6-1]' to '$[8.0.6]'

       XTRABACKUP_VERSION_DASH="$(echo "${XTRABACKUP_VERSION%-*}" | sed -E "s/(.*)\./\1./")" && \

       ## '$[8.0.6-1]' to '$[80]'

       XTRABACKUP_VERSION_MINOR="$(echo "${XTRABACKUP_VERSION%.*}" | sed "s#\.##g")" && \

       #https://www.percona.com/downloads/Percona-XtraBackup-2.4/Percona-XtraBackup-2.4.18/binary/redhat/7/x86_64/percona-xtrabackup-24-2.4.18-1.el7.x86_64.rpm

       wget -q -O /tmp/xtrabackup.rpm \

       "https://www.percona.com/downloads/Percona-XtraBackup-2.4/Percona-XtraBackup-${XTRABACKUP_VERSION_DASH}/binary/redhat/7/x86_64/percona-xtrabackup-${XTRABACKUP_VERSION_MINOR}-${XTRABACKUP_VERSION}.el7.x86_64.rpm" && \

       yum localinstall -y /tmp/xtrabackup.rpm;

   For example, enter the following:

       FROM cvmysql_11_22:849

       #install mysql client 5.7 packages

       RUN yum-config-manager --disable MariaDB; yum -y remove mariadb mariadb-server; yum -y install wget;\

       wget https://repo.mysql.com/mysql57-community-release-el7.rpm;\

       yum -y localinstall mysql57-community-release-el7.rpm;\

       yum -y install mysql;

       #install percona xtrabackup rpm

       ARG XTRABACKUP_VERSION="$[2.4.18-1]"

       RUN set -x && \

       # do special versioning for percona

       ## '$[8.0.6-1]' to '$[8.0.6]'

       XTRABACKUP_VERSION_DASH="$(echo "${XTRABACKUP_VERSION%-*}" | sed -E "s/(.*)\./\1./")" && \

       ## '$[8.0.6-1]' to '$[80]'

       XTRABACKUP_VERSION_MINOR="$(echo "${XTRABACKUP_VERSION%.*}" | sed "s#\.##g")" && \

       #https://www.percona.com/downloads/Percona-XtraBackup-2.4/Percona-XtraBackup-2.4.18/binary/redhat/7/x86_64/percona-xtrabackup-24-2.4.18-1.el7.x86_64.rpm

       wget -q -O /tmp/xtrabackup.rpm \

       "https://www.percona.com/downloads/Percona-XtraBackup-2.4/Percona-XtraBackup-${XTRABACKUP_VERSION_DASH}/binary/redhat/7/x86_64/percona-xtrabackup-${XTRABACKUP_VERSION_MINOR}-${XTRABACKUP_VERSION}.el7.x86_64.rpm" && \

       yum localinstall -y /tmp/xtrabackup.rpm;

   Where, `cvmysql_11_22:849` is the Docker container image for Commvault that was created earlier.

2. Run the following command to create the image:

       docker build -f $[dockerBase_file_path] -t $[image_tag] $[PATH]

   For example, enter the following:

       docker build -f $[MyDockerFile] -t $[cv_11_22_test:nov26] $[/tmp]

3. Run the following command to verify that the image was created successfully:

       docker images

   If the Docker image was created successfully, you will see the image name and other details in the output screen.

4. Run the following command to tag the Commvault Docker image:

       docker tag $[xxxxx] $[repository server]:$[5000]/$[image name]

   For example, enter the following:

       docker tag $[3b3525bac385] $[gkkubernet1]:$[5000]/$[cv_nov26_sp23:latest]

5. Run the following command to push the image to the Docker repository:

       docker push $[image_name]

×

Loading...