Can't mount FreeNAS shares with rancher-nfs

So I’m trying to use rancher-nfs to mount my NFS shares for persistent storage.

If I use rancher-nfs without any MOUNT_OPTS and leave it with just the nfsvers=4 option it will create a volume and also create a folder within my nfs share after starting the service, so it seems that the driver has access.
But the container still fails with “Error response from daemon: chown /var/lib/rancher/volumes/rancher-nfs/home-assistant: invalid argument”.

I’ve read that I need the parameter no_root_squash to get this working. But when I add no_root_squash to the rancher-nfs containers MOUNT_OPTS, I’ll get an error like “VolumeDriver.Create: Failed mount -o nfsvers=4 192.168.1.3:/mnt/storage/docker/home-assistant /tmp/eca4”

On my FreeNAS I’ve tried using mapall to root:wheel and I’ve also tried to use maproot root:wheel, which didn’t make a difference, even though mapall to root should work like no_root_squash. I’ve also enabled NFSv4 within FreeNAS.

Mounting the share directly within the host works fine, so why doesn’t it work? Is it because of FreeNAS or because of my configuration? I’m using RancherOS 1.0.2 and rancher/server:stable (I’m new to all this so I guess stable is version 1.6.2?)

[details=Here is the docker-compose.yml for the Stack I wanna create]version: "2"
volumes:
home-assistant:
external: true
driver: rancher-nfs
services:
home-assistant:
image: homeassistant/home-assistant
network_mode: "host"
restart: unless-stopped
volumes:
- home-assistant:/config
- /etc/localtime:/etc/localtime:ro[/details]

So I just used another docker-compose.yml with a basic ubuntu image and bash to try if my compose file is the problem and it indeed IS the problem!

Working docker-compose.yml

test:
image: ubuntu
volume_driver: rancher-nfs
tty: true
volumes:

  • test_volume:/data
    command:
  • bash

So it seems it’s neither the fault of rancher-nfs or FreeNAS, it’s probably the home-assistant image…

I had the same issue with a stack I was trying to create. I found this article and what ended up working for me was the nocopy flag at the end of the volume line. This is what my stack yml ended up looking like:

version: '2'
volumes:
  notebooks:
  external: true
  driver: rancher-nfs
services:
  nfldb-phppgadmin:
    image: einfallstoll/phppgadmin
    environment:
      POSTGRES_DEFAULTDB: nfldb
      POSTGRES_HOST: pnfldb-pgsql
      POSTGRES_PORT: '5432'
    ports:
    - 8080:80/tcp
    - 8443:443/tcp
  nfldb-jpy:
    image: kakashi20/nfldb-jpy
    environment:
      PGHOST: nfldb-pgsql
      PGPASSWORD: go_cowboys
      PGPORT: '5432'
      PGUSER: nfldb
    volumes:
    - notebooks:/home/jovyan/work:nocopy
    ports:
    - 8888:8888/tcp
    user: root
  nfldb-pgsql:
   image: kakashi20/nfldb-pgsql
    volumes:
    - /var/lib/postgresql/data
    ports:
    - 5432:5432/tcp