Before we get started on using Netshare with NFS filesystems make sure you installed the prerequisites as noted in the Getting Started guide.
NFS needs to be installed on Linux systems in order to properly mount NFS mounts.
sudo apt-get install -y nfs-common
sudo yum install -y nfs-utils
It is recommend to try mounting an NFS volume to eliminate any configuration issues prior to running the plugin:
sudo mount -t nfs4 220.127.116.11:/mountpoint /target/mount
If you have installed Netshare as a deb package then make sure the service is running. If you are simply playing with the driver to evaluate, you can open a separate terminal window and run in the foreground:
$ sudo docker-volume-netshare nfs
For this example we’ll run an Ubuntu container and mount a remote share into a
/data directory within the container:
$ docker run -i -t --volume-driver=nfs -v nfshost/path:/data ubuntu /bin/bash root@3ff00e59c734:/$ ls /data
You can also create named volumes using the
docker volume syntax. To do this we must use the
$ docker volume create -d nfs --name myvol -o share=nfshost:/share $ docker run -it --rm -v myvol:/data ubuntu bash
To mount volumes during compose orchestration you must define the volume in the YML.
version: '2' volumes: data: driver: nfs driver_opts: share: host:/share services: hello: image: alpine volumes: - data:/mnt command: ls /mnt
There may be specific NFS settings that aren’t handled out of the box. One example may be a different port number for the NFS server. To pass through custom
Globally on launch:
$ docker-volume-netshare nfs -o port=2049,sec=ntlm
As a named volume:
$ docker volume create -d nfs --name myvol -o share=myserver:/share -o port=2049