Mount Docker MysqlVolume on NFS

Hello to everyboy.

I’m trying to create a mysql container with a volume on NFS, but I receive this error like operation not permitted or error in chmod.
My NFS server is my PC and the client is a raspberry.
Before work with mysql container I tried with the Node-RED container always with the volume on NFS and It has worked, but with hypriot/rpi-mysql (mysql for raspian I receive some error.)
The steps that I have done are the following:

First above I configured my NFS server, create directory

sudo mkdir -p /export/mysql

I configured my /etc/exports as follow:

/export *(rw,sync,no_subtree_check,insecure)
/export/rednode *(rw,sync,no_subtree_check,insecure)
/export/mysql *(rw,sync,no_subtree_check,insecure)

Full privilege to everybody. And I can see the directory on my raspberry cause I mount the exposed directories to the that all words.

Now on my cliente I create the volume, as follow:

sudo docker volume create --driver local \
    --opt type=nfs \
    --opt o=addr=10.0.0.5,nfsvers=4 \
    --opt device=:/export/mysql \
    mysql

In the same way I created the volume for my NODE-Red.

I run my container:

sudo docker run --name some-mysql -v mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -p 52000:3306 -d hypriot/rpi-mysql

And I receive this error:

docker: Error response from daemon: failed to chmod on /var/lib/docker/volumes/mysql/_data: chmod /var/lib/docker/volumes/mysql/_data: operation not permitted.

I tried all configuration but without any good result.

Does somebody have some idea about it doesn’t work?

Thanks a lot to every bod for the time.

Best Regards

Alessandro

1 Like

Here’s what I did for Elasticsearch with OpenMediaVault on a Raspberry Pi running the NFS mount.

VOL=$(docker volume create \
    --driver local \
    --opt type=nfs \
    --opt device=":/export/elasticsearch" \
    --opt o="addr=nas")

docker run -it --rm -v $VOL:/mnt:nocopy alpine "$@"

Key thing to note is :nocopy second the export (at least on OpenMediaVault) must be owned and writable by nobody otherwise no files can be written out.

Remove the volume afterwards by doing

docker volume rm $VOL > /dev/null
1 Like