I want mysql read/write data to my RBD image. I use rbd-docker-plugin to mount RBD into docker pull from https://hub.docker.com/_/mysql/
First I try
docker run -it --volume-driver=rbd --volume foo:/mnt/foo ceph/base bash
and I touch "aa" file inside /mnt/foo in docker then I stop docker and when I mount foo
into another docker "aa" file still exist
Then I add my code into this Docker file
RUN mkdir -p /mnt/foo/mysql
RUN sed -i -e 's/\/var\/lib\/mysql/\/mnt\/foo\/mysql/g' /etc/mysql/my.cnf
VOLUME /mnt/foo/mysql
and build, run docker from this new Dockerfile
docker run -it --volume-driver=rbd --volume storage2/foo:/mnt/foo -e MYSQL_ROOT_PASSWORD=password [image_id]
when I exec container I can use mysql and I see data of mysql (and "aa" file) in /mnt/foo/mysql, But when I stop docker and mount foo into another docker I can't see anything about mysql (but I still see "aa" file)
Finally I try
docker run --name some-mysql --volume-driver=rbd --volume foo:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw mysql
but it error
[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist