Docker Community Forums

Share and learn in the Docker community.

"error while mounting volume with options: type='nfs' device=':/var/nfs' o='addr=IPaddr,rw': permission denied"

Defining a docker compose file creates the service, network and volume (external=true) on:
Ubuntu 18.04
Docker version 18.09.2, build 6247962

version: '3.5'
services:
  jupyterhubserver:
    image: sgsupdocker/jupyterhub-onbuild:052019
    hostname: jupyterhubserver
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - nfsvolume:/var/nfs
    networks:
      jupyterhub:
        aliases:
          - jupyterhubserver
    deploy:
      placement:
        constraints:
          - node.role == manager
    ports:
      - 8000:8000

networks:
  jupyterhub:
    driver: overlay
    attachable: true
    name: jupyterhub

volumes:
  nfsvolume:
    external: true

script to create the docker volume:

docker volume create --driver local \
    --opt type=nfs \
    --opt o=addr=ipaddr,rw \
    --opt device=:/var/nfs \
    nfsvolume

Both the source and destination are +rw for all users and groups. But when I exec: docker stack deploy -c docker-compose.yml Hub The service fails to create a container that can map the docker volume:nfsvolume to the container folder:/var/nfs.
I get the error: "error while mounting volume with options: type=‘nfs’ device=’:/var/nfs’ o=‘addr=ipaddr,rw’: permission denied"

So I brought up the image being used the yaml file with : docker run --rm -it image /bin/bash and verified that the container folder /var/nfs was writeable and similarly tested the host location. So what am I missing here??
any help is greatly appreciated

Alvin