Unable to mount zfs host directory in container

Setup: Ubuntu 18.04 running Docker 17.06.2-ce.

I have a zfs array mounted that I can access fine on the host.

$ mount | grep zfs

Main on /Main type zfs (rw,xattr,noacl)

Main/Media on /Main/Media type zfs (rw,xattr,noacl)

$ ls -la /Main
total 48
drwxr-xr-x  8 root root          8 Oct 18  2015 .
drwxr-xr-x 24 root root       4096 Jul 31 23:16 ..
drwxrwxr-x 13 root libvirtd     16 Oct 28  2015 Media
drwxr-xr-x  2 root root          2 Oct  2  2015 NFS
drwxr-xr-x  3 root root          3 Dec 12  2014 Repos
drwxrwxrwx  4  816 libvirtd      4 Oct  3  2015 VMs

When I try to bind mount it within a Docker container, however, I receive an error that it’s read-only (implying that it couldn’t find the directory on the host):

$ docker run -d -v "/Main/Media/Video:/mnt/video:ro" -p 32400:32400 pms
10bafd8e117bd706fce99a20de108f6abaf069609d56a30114ec5db842b1b353
docker: Error response from daemon: error while creating mount source path '/Main/Media/Video': mkdir /Main: read-only file system.

I saw people having similar issues with nfs but can’t find anything zfs specific – shouldn’t this be filesystem agnostic anyways since I’m doing a bind mount?

Any assistance would be appreciated!

1 Like

I have the exact same issue! Any luck on this?

So this is related to it being a “snap” install, in my case. If you install it outside of “snap” it will work.

1 Like

Thanks for the answer, yes, after some googling, I found the same solution! Installing with
apt helped! :tada: