Hey everyone,
I am running into an issue with Docker Swarm in combination with NFS-mounted volumes, in particular when I “migrate” a server to another node in the swarm.
Some context: I have a docker swarm with multiple nodes. I have one node I use as test environment and multiple others which I use as production environment. I use placement constraints to tell the services where to go.
I recently was playing around with Ntfy and decided to use it for UptimeKuma notifications. Once testing was done I moved it to my production node (1 replica). The service started fine, but the configuration seemed to be off. I checked the container’s data directory and found it was empty. I then checked the host and found that the volume, even though created, was not mounted.
When I did an inspect of the volumes of the hosts of my test- and production environment, I noticed that on my production environment the mount options were missing:
Volume inspect of test node (this is also the node on which I initially created the volume using portainer):
docker volume inspect Ntfy
[
{
"CreatedAt": "2023-02-17T14:41:36+01:00",
"Driver": "local",
"Labels": null,
"Mountpoint": "/var/lib/docker/volumes/Ntfy/_data",
"Name": "Ntfy",
"Options": {
"device": ":/export/xxxxxxxx/Ntfy",
"o": "addr=xxxxxxxxxx,rw,noatime,rsize=8192,wsize=8192,tcp,timeo=14,nfsvers=4",
"type": "nfs"
},
"Scope": "local"
}
]
Inspect of the volume created by docker swarm on the production environment after I migrated the service:
docker volume inspect Ntfy
[
{
"CreatedAt": "2023-02-22T17:07:31+01:00",
"Driver": "local",
"Labels": null,
"Mountpoint": "/var/lib/docker/volumes/Ntfy/_data",
"Name": "Ntfy",
"Options": null, <<<=== ????
"Scope": "local"
}
]
Anyone have any idea why the mount options are not passed onto the volume? I suspect this is the reason the volume is not mounted.