Differences in the bitnami xtrabackup docker image?

I am running the following command within my bash file:
sudo docker run --rm -it -v /var/lib/docker/volumes/mysql_data/_data:/var/lib/mysql -v $BACKUP_DIR:/xtrabackup_backupfiles percona/percona-xtrabackup:8.0.32-26 xtrabackup --backup --no-defaults --compress=lz4 --host=mysql --user=root --password=secret --target-dir=“/xtrabackup_backupfiles/$MONTHLY_BACKUP”

It works perfect this way. But if I change to the bitnami image, it gives me the following output:
2023-05-31T12:45:52.413847-00:00 0 [Note] [MY-011825] [Xtrabackup] recognized client arguments: --backup=1 --host=mysql --user=root --password=* --target-dir=/xtrabackup_backupfiles/monthly_2023-05
2023-05-31T12:45:52.414013-00:00 0 [ERROR] [MY-011825] [Xtrabackup] unknown argument: ‘xtrabackup’

Is there any difference on how to handle the parameters in the bitnami image? or is that a bug?

Hi Martin.

The way to use both image is different.

Percona Image - you need to pass the binary name + arguments:

$ docker run --rm --name percona-xtrabackup percona/percona-xtrabackup:8.0.32-26 xtrabackup --version
xtrabackup version 8.0.32-26 based on MySQL server 8.0.32 Linux (x86_64) (revision id: 34cf2908)

Bitnami Image - it interprets everything after the image name as parameter to xtrabackup:

$ docker run --rm --name percona-xtrabackup bitnami/percona-xtrabackup:latest --version
xtrabackup version 8.0.33-27 based on MySQL server 8.0.33 Linux (x86_64) (revision id: 6743d8c7)

So on your case you should do:

sudo docker run --rm -it -v /var/lib/docker/volumes/mysql_data/_data:/var/lib/mysql -v $BACKUP_DIR:/xtrabackup_backupfiles bitnami/percona-xtrabackup:latest --backup --no-defaults --compress=lz4 --host=mysql --user=root --password=secret --target-dir=“/xtrabackup_backupfiles/$MONTHLY_BACKUP”

Thanks for the clarification. Funny that with the --version parameter it runs either way. For the backup parameter you really need to take out the xtrabackup command like you said. And they do not clarify that on their docker image documentation.

Now after correcting that I get the following output:
2023-05-31T14:15:41.996331-00:00 0 [Note] [MY-011825] [Xtrabackup] recognized client arguments: --backup=1 --compress=lz4 --host=localhost --user=root --password=* --incremental-basedir=/xtrabackup_backupfiles/monthly_2023-05 --target-dir=/xtrabackup_backupfiles/daily_2023-05-31
xtrabackup version 8.0.32-26 based on MySQL server 8.0.32 Linux (x86_64) (revision id: 34cf2908)
Can’t locate English.pm in @INC (you may need to install the English module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl) at - line 3.
BEGIN failed–compilation aborted at - line 3.
2023-05-31T14:15:42.008561-00:00 0 [Note] [MY-011825] [Xtrabackup] Connecting to MySQL server host: localhost, user: root, password: set, port: not set, socket: not set
2023-05-31T14:15:42.008861-00:00 0 [ERROR] [MY-011825] [Xtrabackup] Failed to connect to MySQL server: Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

Same command with the percona image is working fine.

there is two issues there

1 . Missing perl package on image - you can set --no-version-check to avoid the perl version check script to run
2. Connection issue. Image is trying to connect to /tmp/mysql.sock which does not exist. Try connecting over port (you will need correct port mapping) or adjust the socket xtrabackup is trying to connect (you also need to make sure the docker instance has access to the socket file).

Thanks for your feedback. I could get rid of the perl error message. Defining the port parameter did not resolve the issue. On the socket file, is that the one in the MySQL data directory? Seems that bitnami xtrabackup searches for it in the tmp directory, while the path is /var/lib/mysql . Do I need to define that path in the socket parameter?

xtrabackup will read the default from my.cnf, looks like bitnami points to /tmp. Adjust xtrabackup parameter to us --soket=/var/lib/mysql/mysql.sock. Please check by the correct socket by running SELECT @@socket; on the server you wish to backup.

Thanks, that was working. I am trying now to get the same thing to work on an ARM64 VPS running Oracle Linux. I am getting the error:
2023-05-31T18:23:11.845472-00:00 0 [ERROR] [MY-011825] [Xtrabackup] cannot mkdir: 13 /xtrabackup_backupfiles/monthly_2023-05/

I already did rwxrwxrwx privilleges on the backup folder and I do not get it to work. What could be the issue causing that problem?

Just figured it out. The absolute path to the backup dir was not right, and so it ended up writing somewhere else. Thanks, got that working nicely now!