Today I’ve tried to mount a NFS into a docker volume via the following means:
- Mount the NFS on the host and create a docker volume using the absolute path
- Create a docker volume via NFS
Both variants have failed miserably, in hte sense that I could get the docker container to “see” it, but read-only.
I’ve used the following sources:
- Ansible docker module
- Samba in docker
- bind propagation
- Making an NFS mount on the host visible and read-write inside Docker container
- Docker the ansible way
- Docker NFS volume using Ansible
- Docker sdk for python
- Mapping UID and GID of local user to the mounted NFS share
- How to properly set permissions for NFS folder? Permission denied on mounting end.
- Ansible mount module
For the time being, I’ll fall back to a different strategy:
- Mount the NFS share
- Create a local folder
- Unpack an archive form the NFS share to the local folder
- Create a docker volume pointing to the local folder
- Start the docker module
- Create a job to archive the content of the local folder into a tarball and copy it to the NFS share
This way, I’ll have a backup on the NAS, in case I need to redeploy the docker image somewhere else.