moby: [1.12.0] docker volume (nfs) is not being mounted in all service replicas [swarm-mode]
Output of docker version:
Client:
Version: 1.12.0
API version: 1.24
Go version: go1.6.3
Git commit: 8eab29e
Built: Thu Jul 28 23:54:00 2016
OS/Arch: darwin/amd64
Server:
Version: 1.12.0
API version: 1.24
Go version: go1.6.3
Git commit: 8eab29e
Built: Thu Jul 28 23:54:00 2016
OS/Arch: linux/amd64
Output of docker info:
Containers: 1
Running: 1
Paused: 0
Stopped: 0
Images: 1
Server Version: 1.12.0
Storage Driver: aufs
Root Dir: /mnt/sda1/var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 3
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host null overlay
Swarm: active
NodeID: 4ib33hyv2maivyi76a7xloffs
Is Manager: true
ClusterID: ci7yzh2bt1xw848mn9mx3g56k
Managers: 1
Nodes: 3
Orchestration:
Task History Retention Limit: 5
Raft:
Snapshot interval: 10000
Heartbeat tick: 1
Election tick: 3
Dispatcher:
Heartbeat period: 5 seconds
CA configuration:
Expiry duration: 3 months
Node Address: 192.168.99.103
Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 4.4.16-boot2docker
Operating System: Boot2Docker 1.12.0 (TCL 7.2); HEAD : e030bab - Fri Jul 29 00:29:14 UTC 2016
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 492.6 MiB
Name: node-1
ID: PI2H:ZR5O:M65T:UOSX:XXYE:NMGO:P3G4:HBNT:F5AX:6ATC:WRAU:TLBA
Docker Root Dir: /mnt/sda1/var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 35
Goroutines: 136
System Time: 2016-07-29T01:59:55.599976175Z
EventsListeners: 1
Registry: https://index.docker.io/v1/
Labels:
provider=virtualbox
Insecure Registries:
127.0.0.0/8
Additional environment details (AWS, VirtualBox, physical, etc.): docker-machine v 0.8.0 virtualbox Mac OSX
Steps to reproduce the issue:
- Create a 3 node swarm mode cluster (1 Manager 2 Workers)
- Create a Volume (local nfs)
- Create a Service with 3 replicas that uses the created Volume
Describe the results you received:
$ showmount -e 192.168.99.1
Exports list on 192.168.99.1:
/Volumes/HDD/tmp 192.168.99.0
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
node-1 * virtualbox Running tcp://192.168.99.103:2376 v1.12.0
node-2 - virtualbox Running tcp://192.168.99.104:2376 v1.12.0
node-3 - virtualbox Running tcp://192.168.99.105:2376 v1.12.0
$ docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
0hppa4e08zz5f0m4yntmq5r2f node-2 Ready Active
4ib33hyv2maivyi76a7xloffs * node-1 Ready Active Leader
523g37vwkhjgzc5h1tmt7rtj5 node-3 Ready Active
# Testing manual NFS mounting in each Docker Host.
$ docker-machine ssh node-1 sudo mkdir -p /mnt/nfstest
$ docker-machine ssh node-1 sudo mount -t nfs 192.168.99.1:/Volumes/HDD/tmp /mnt/nfstest
$ docker-machine ssh node-1 sudo ls -la /mnt/nfstest # OK LISTS ALL FILES
$ docker-machine ssh node-2 sudo mkdir -p /mnt/nfstest
$ docker-machine ssh node-2 sudo mount -t nfs 192.168.99.1:/Volumes/HDD/tmp /mnt/nfstest
$ docker-machine ssh node-2 sudo ls -la /mnt/nfstest # OK LISTS ALL FILES
$ docker-machine ssh node-3 sudo mkdir -p /mnt/nfstest
$ docker-machine ssh node-3 sudo mount -t nfs 192.168.99.1:/Volumes/HDD/tmp /mnt/nfstest
$ docker-machine ssh node-3 sudo ls -la /mnt/nfstest # OK LISTS ALL FILES
$ docker-machine ssh node-1 sudo umount /mnt/nfstest
$ docker-machine ssh node-2 sudo umount /mnt/nfstest
$ docker-machine ssh node-3 sudo umount /mnt/nfstest
# Now, with Docker [Swarm Mode]
$ docker volume create --driver local --opt type=nfs --opt o=addr=192.168.99.1,rw --opt device=:/Volumes/HDD/tmp --name nfstest # OK
$ docker service create --endpoint-mode dnsrr --replicas 3 --mount type=volume,source=nfstest,target=/mount --name nfstest alpine /bin/sh -c "while true; do echo 'OK'; sleep 3; done" # OK
$ docker service ps nfstest
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR
5z0vj3fa3wjwzzpjbmgj5wyzi nfstest.1 alpine node-1 Running Running 38 minutes ago
6p2dqcw4ufv2qzn5eikyge5tg nfstest.2 alpine node-3 Running Running 38 minutes ago
ewm7097mwmelkddhwq4k6m4up nfstest.3 alpine node-2 Running Running 38 minutes ago
# Testing /mount inside each container created.
# First NODE (MANAGER)
$ docker $(docker-machine config node-1) ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a0dec4cea427 alpine:latest "/bin/sh -c 'while tr" 39 minutes ago Up 37 minutes nfstest.1.5z0vj3fa3wjwzzpjbmgj5wyzi
$ docker $(docker-machine config node-1) exec -it a0dec4cea427 /bin/sh -c "ls -la /mount"
# OK LISTS ALL FILES
# Second NODE (Worker)
$ docker $(docker-machine config node-2) ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
eae8ca49b762 alpine:latest "/bin/sh -c 'while tr" 40 minutes ago Up 38 minutes nfstest.3.ewm7097mwmelkddhwq4k6m4up
$ docker $(docker-machine config node-2) exec -it eae8ca49b762 /bin/sh -c "ls -la /mount"
# BUG # NOT OK - EMPTY FOLDER
# Third NODE (Worker)
$ docker $(docker-machine config node-3) ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bf667e19969f alpine:latest "/bin/sh -c 'while tr" 41 minutes ago Up 38 minutes nfstest.2.6p2dqcw4ufv2qzn5eikyge5tg
$ docker $(docker-machine config node-3) exec -it bf667e19969f /bin/sh -c "ls -la /mount"
# BUG # NOT OK - EMPTY FOLDER
Describe the results you expected:
At # Second NODE (Worker) and # Third NODE (Worker), I expected to list NFS Volume Files as # First NODE (MANAGER)
Additional information you deem important (e.g. issue happens only occasionally):
Same issue happens in 1.12.0-rc2 , 1.12.0-rc4 and 1.12.0-rc5
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 1
- Comments: 21 (9 by maintainers)
@cpuguy83 I really don’t get it. I am probably missing something very fundamental here, but I see many others having the same issues and concerns, so probably the current behaviour is not so intuitive. For instance, why if I create a nfs volume using netshare plugin, when I create a service using that said volume, all the nodes where the service start containers on also get a volume, with the same name, but it is not using the nfs driver, it uses the local driver, which means the container starts and run, but using wrong storage. Either you give an error, or it works, because otherwise this silent failing, or the almost-working-but-not-really kind of behaviour makes very difficult to understand what is the correct way of doing things…