@matthewb Thank you for the reply! I found a solution for my own problem.
I did check permissions for the /var/lib/mysql folder. Inside of the mysql 8.0 docker container is is owner by ‘mysql’’ user. The volume on the host side for the /var/lib/mysql is owned by systemd-coredump:systemd-coredump.
After I looked inside of percona/percona-xtrabackup:8.0 image layers on DOcker, I discovered that the USER inside of the container has UID 1001:
35 USER 1001 0 B
36 CMD ["/usr/bin/xtrabackup"] 0 B
On my server MySQL runs in docker also and a host machine has no user with UID 1001. I assumed the user with UID 1001 should be ‘mysql’ user, that is translated from docker ‘mysql’ user into host ‘systemd-coredump’ user. I found UID and GID of the ‘systemd-coredump’ user on a host machine (UID=999).
And when I start xtrabackup container in docker with “–user 999:999” option, everything starts working.
Here is my xtrabackup docker run command:
docker run --rm --name xtrabackup80-container \
–user 999:999 --cap-add=sys_nice \
–volumes-from MySQL80-container \
percona/percona-xtrabackup:8.0 \
xtrabackup \
–defaults-file=/etc/mysql/conf.d/my.cnf \
–host=localhost \
–port=3306 \
–socket=/run/mysqld/mysqld.sock \
–backup \
–datadir=/var/lib/mysql \
–target-dir=/home/backups/xtrabackup \
–user=[backup-user] \
–password=[password]