By default, the SqlBak Docker container includes client utilities for working with databases, such as sqlcmd
, mysql
, mysqldump
, psql
, pg_dump
, and pg_restore
. However, these utilities may not be backward compatible with older database versions.
For example, when connecting to a MySQL 8.1 database using the mysqldump
utility from the Docker container, which is designed for MySQL 8.4, issues may arise due to differences in protocols and functionality.
For this purpose, we provide a version of SqlBak without preinstalled utilities. Dedicated images are available for Ubuntu 18, 20, and 22 to accommodate this need.
When using these Docker images, you will need to manually install the required client utilities in the containers by creating your own Docker image.
This can be done as follows:
1. Create a Dockerfile
with the following content:
FROM pranasnet/sqlbak-clear-ubuntu20 #here, we install the necessary utilities ENTRYPOINT ["/etc/sqlbak/run.sh"]
2. Build your image:
docker build -t my-sqlbak .
and use the Docker image as described on the page.
Example of using SqlBak Docker container with MySQL 8.0.40
In later versions, the mysqldump
utility uses the SHOW BINARY LOG STATUS
command, which is not available in older MySQL versions.
To allow SqlBak to perform backups, it must use utilities compatible with your MySQL version. To achieve this, you can create a custom SqlBak image with the required version of MySQL installed.
FROM pranasnet/sqlbak:sqlbak-clear-ubuntu20 RUN apt update && apt install -y wget libaio1 libmecab2 libncurses5 && rm -rf /var/lib/apt/lists/* WORKDIR /tmp RUN wget https://downloads.mysql.com/archives/get/p/23/file/mysql-server_8.0.40-1ubuntu20.04_amd64.deb-bundle.tar \ && tar -xvf mysql-server_8.0.40-1ubuntu20.04_amd64.deb-bundle.tar \ && rm mysql-server_8.0.40-1ubuntu20.04_amd64.deb-bundle.tar RUN dpkg -i mysql-common_8.0.40-1ubuntu20.04_amd64.deb \ && dpkg -i mysql-community-client-plugins_8.0.40-1ubuntu20.04_amd64.deb \ && dpkg -i libmysqlclient21_8.0.40-1ubuntu20.04_amd64.deb \ && dpkg -i libmysqlclient-dev_8.0.40-1ubuntu20.04_amd64.deb \ && dpkg -i mysql-community-client-core_8.0.40-1ubuntu20.04_amd64.deb \ && dpkg -i mysql-community-client_8.0.40-1ubuntu20.04_amd64.deb \ && dpkg -i mysql-client_8.0.40-1ubuntu20.04_amd64.deb \ && apt -f install -y RUN rm -rf /var/lib/mysql ENTRYPOINT ["/etc/sqlbak/run.sh"]