Hello,
I have a docker container with MySQL 5.6 and Percona Xtrabackup 2.4 that runs in docker container either.
MySQL 5.6 comtainer was created with docker-compose.yml file:
Xtrabackup docker container was created with the command:
version: ‘3’
services:
mysql56:
image: mysql:5.6
restart: unless-stopped
container_name: mysql56-container
ports:
- “127.0.0.1:3306:3306”
environment:
MYSQL_ROOT_PASSWORD: ${DB_PASSWD}
volumes:
- /usr/local/docker-custom/mysql56-container/mysql/conf.d:/etc/mysql/conf.d
- ${DB_VOLUME}:/var/lib/mysql
- /home/${MY_USER}/support:/home/support
- /home/${MY_USER}/backups:/home/backups
Xtrabackup 2.4 container was created with the below command:
docker create
–name xtrabackup24-container
–volumes-from mysql56-container
percona/percona-xtrabackup:2.4
xtrabackup
– defaults-file=/etc/mysql/
conf.d/my-32G.cnf`
–host=localhost --port=3306
–socket=/var/run/mysqld/mysqld.sock \
–backup --datadir=/var/lib/mysql
–target-dir=/home/backups/xtrabackup
–user=root --password=root_password
When I start xtrabackup with the command:
$ docker start -ai xtrabackup24-container
xtrabackup tryes to connect to MySQL 5.6 server:
Connecting to MySQL server host: localhost, user: root, password: set, port: 3306, socket: /var/run/mysqld/mysqld.sock
Failed to connect to MySQL server: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
When I change the server IP to the IP the MySQL5.6 container runs on:
$ docker inspect mysql56-container | grep “IPAddress”
“SecondaryIPAddresses”: null,
“IPAddress”: “”,
“IPAddress”: “172.19.0.2”,
The connection erroris Failed to connect to MySQL server: Can’t connect to MySQL server on ‘172.19.0.2’ (110)
What am I doing wrong?
Any help is highly appreciated.
Regards, geneva_nn