How to make a copy of the dB, spinning in the Docker (the storage volume) using xtrabackup?

xtrabackup on the host
him to copy the database requires access to /var/run/mysqld/mysqld.sock
MariaDB container
Running this:
docker run --name 10.1.23-mariadb -p 3308:3306 -v /opt/test/mariadb/var/lib/mysql -e MYSQL_ROOT_PASSWORD=password -d mariadb:10.1.23

Mounting /var/run/mysqld/ does not work - the file does not appear on the host and still disappears in a container - the database stops working.
How can I manage it?
June 7th 19 at 15:38
3 answers
June 7th 19 at 15:40
In short:
echo /var/lib/docker/aufs/diff/$(cat /var/lib/docker/image/aufs/layerdb/mounts/$(docker inspect --format="{{.Id}}" 10.1.23-mariadb)/mount-id)/run/mysqld/mysqld.sock

and get a direct path to the socket

I do not care that it can change after a rebase, because it is only for a test, and if it is in the real world this configuration - my.cnf can be generated by the script
June 7th 19 at 15:42
can help

in General, you can mount it to /var/run/mysqld/mysqld.sock, but this file should already be up to start the container.
June 7th 19 at 15:44
Do not mix the containers with the processes on the host.
To mount the directory for the backup in advance, to run xtrabackup from the container.
How to run xtrabackup from the container with mariadb, which it, of course not.. Create your container with both applications? I would, of course, use the standard - cheste commented on June 7th 19 at 15:47
Since I use third-party utilities will have to torture docker build. - Gregg_Kovac commented on June 7th 19 at 15:50

Find more questions by tags MariaDBDockerMySQL