Rancher Multiple Nfs Mountpoints
In my previous blog I explained how to use the Rancher-NFS service. In this blog I will explain how you can add multiple NFS mountpoints to a container, by using this same Rancher-NFS driver. It is important that your Rancher version is at least 1.6.0 and that the Rancher-NFS service is upgraded to v0.8.3. This upgrade brings the following driver options;
driver_opts: host: <NFS Server> export: <Share>
Unfortunately, as far as I know, this cannot be done in the UI yet. Below a simple configuration I used to test this out on a simple Ubuntu container, which will get two mountpoints;
- The /root folder will be mounted to the default Rancher share on my NFS server and will create a folder there named ‘test’.
- The /uploads folder will be created and mounted to my uploads folder on my NFS server
This will result in the following configuration changes in the docker-compose.yml file.
volumes: test: external: true driver: rancher-nfs music: driver: rancher-nfs driver_opts: host: gimli.thuis.breekeenbeen.nl export: /volume2/uploads
The rancher-compose.yml doesn’t need any modification. For completeness below the comple docker-compose.yml.
version: '2' services: storage-test: image: ubuntu:14.04.3 stdin_open: true volumes: - test:/root - uploads:/uploads tty: true labels: io.rancher.container.pull_image: always volumes: test: external: true driver: rancher-nfs uploads: driver: rancher-nfs driver_opts: host: gimli.thuis.breekeenbeen.nl export: /volume2/uploads