My main Docker deployments are on a single linux server. I have a central ‘data’ directory where I keep my common data. The application specific data or settings are stored in /srv/
But for testing or demos I am usually using local Docker installations on my McBook or McBook Air under OS/X. I am using NFS to access the shared central data.
In this Blog I give a quick overview of the setup:
- Install the NFS Server. There are plenty of good tutorials on the Internet that describe how to do this. I was using this. It would even be an option to run the NFS Server as Docker Container.
Create Exports for the Directories on the Server. Fortunately I could use the NFS Exports screen from Webmin. Here is the definition for sharing the /srv directory:
I am using a Zerotier virtual Network so that I can access my local resources also from the public Internet. Therefore I was defining the corresponding IP network and netmask.
- Now we are ready to use the exported directories. Here is the docker-compose.yml file which is using NFS volumes:
version: '3.2' services: beakerx: image: pschatzmann/data-science:1.2.0 container_name: beakerx hostname: beakerx restart: always ports: - 8007:8888 - 9000:9000 volumes: - nfs-srv:/home/beakerx - nfs-data:/data environment: - TZ=Europe/Zurich dns: - 184.108.40.206 extra_hosts: - "nuc.local:10.147.17.177" volumes: nfs-srv: driver: local driver_opts: type: nfs device: ":/srv/data-science" o: "addr=10.147.17.177,nolock,soft,rw" nfs-data: driver: local driver_opts: type: nfs device: ":/data" o: "addr=10.147.17.177,nolock,soft,rw"