John AC Lupe
John AC Lupe

Reputation: 19

Docker and remote volumes

I have a problem with volumes residing on a NAS.

The connection to the shares is working fine. With both SMB and NFS, I could mount the shares to the docker host using the following entries in fstab

<IP of the NAS>:/volume1/sharenfs /nas/nfs nfs _netdev,bind 0 0
//<IP of the NAS>/sharesmb /nas/smb cifs _netdev,bind,credentials=/root/.cifs-credentials,iocharset=utf8,vers=3.0,uid=0,gid=0 0 0

Creating directories and files via the Docker Host works fine. However, as soon as I start a container and create data on the shares, it only works conditionally. For example, portainer/portainer works without any limitations, but kempkensteffen/usvn or yobasystems/alpine-mariadb won't work as expected. During setup of usvn there are missing permantent write permissions on the config volume.

In the Docker documentation it says that instead of direct paths Docker Volumes should be used. So I created the volumes as documented:

docker volume create \
    --driver local \
    --opt type=nfs \
    --opt o="vers=4,addr=<IP of NAS>,rw" \
    --opt device=:<Path on NAS> \
    v_portainer

and

docker volume create \
    --driver local \
    --opt type=cifs \
    --opt o=addr=<IP of NAS>,rw \
    --opt device=//<IP of NAS>/<Share on NAS> \
    --opt o=uid=0,username=<smbuser>,password=<smbpassword>,nounix,file_mode=0770,dir_mode=0770 \
    v_portainer

So I removed the fstab entries and created the volumes with the given syntax. But this results also in the same effect - portainer works, but the others won't. Now I am quite helpless and grateful for every tip. Note: I've tested both, NFS and CIFS without success.

The environment consists of:

Upvotes: 0

Views: 4705

Answers (1)

John AC Lupe
John AC Lupe

Reputation: 19

I found out that Docker is doing some kind of mount as well. My guess is that there will be problems with these mounts.

My solution is to use a block level device over an iSCSI mount instead of a filesystem. So all containers worked as expected.

Upvotes: 0

Related Questions