Share nfs volume docker swarm


//Docker stack

version: "3.7"
services:
  web:
    image: nginx
    volumes:
      - nginx.vol:/usr/share/nginx/html
    ports:
      - 80:80
    networks:
      - web

networks:
  web:
    driver: overlay
    name: web

volumes:
  nginx.vol:
    driver: local
    driver_opts:
      type: "nfs"
      o: addr=192.168.0.13,nolock,soft,rw
      device: ":/media/fdisk"


// nfs setting /etc/exports

/media/fdisk *(rw,insecure,sync,no_subtree_check,no_root_squash)


I had problem with nfs share if i use vfat partition, and i change to ext4 for partition usb fdisk and now all volumen working properly (dont forget to change media share to 777 if you have problem to read and write)

Source :

https://pimylifeup.com/raspberry-pi-nfs/

https://sysadmins.co.za/docker-swarm-persistent-storage-with-nfs/

https://linuxize.com/post/how-to-mount-an-nfs-share-in-linux/

https://serverfault.com/questions/212178/chown-on-a-mounted-nfs-partition-gives-operation-not-permitted