Docker volume plugin for ZFS/TrueNAS?

Hi

Has anyone come across a plugin for docker volumes that allows you to connect a TrueNAS app (docker container) to a ZFS dataset and/or zVol?

Docker Volumes allow Docker to understand and manage its storage dependencies, and I’ve seen plugins for Flocker, GCE, Azure, and GlusterFS.
For smaller volumes local volumes (as default in TrueNAS apps) is good, but for larger volumes and volumes that you would like to access via a SMB/NFS share it would be awesome to mount a ZFS dataset as a docker volume. I can image zVol’s would be good to mount into docker as well.

I am using Docker bind mounts to mount ZFS datasets direct into containers for now, and a plugin may not exist, but thought I would ask the minds here in case I’m missing an opportunity.

Thanks,

MC

Yes, you can do this:

  • Edit the App
  • Under Storage Configuration->Additional Storage add a new volume of type Host Path
  • Hive it the path within the container and the path to the host dataset

You can also change an existing volume from using ix-volume to Host Path.

Hi thanks @Evan123 yes that method uses what docker calls a bind mount which are reliable but like many things come with pro’s and con’s.

I am using those today to connect data sets where I need too, but I am wondering if anyone has come across a Docker Volume Plugin for ZFS/TrueNAS to use Docker’s native methods instead.

Hi Mike – what are you hoping will be different?

With TrueNAS you are not meant to take too much interest in what goes on under the hood. You can do pretty much anything with docker that you could do in docker-compose, but not reconfigure docker itself to work fundamentally differently, at least not within the TrueNAS supported product.

Docker works quite well with NFS mounting volumes from TrueNAS

In my experience this works vest when you use a docker compose volume with custom nfs mount options.

This will mount/unmount the volume as yoi start/stop the stack

The issues with NFS are still present… namely its NFS and not a full posix filesystem or a Linux VFS. But its good enough for many things.

And you can specify complex mount options. And the confuguration is contained to the compose.

If you change the compose, just delete the volume (down -v) and it will regenerate and reconnect to the remote again.

Note: down -v deletes all volumes in the stack.

That would be a docker server running outside TrueNAS mounting a TrueNAS share? Yes, that makes sense.

I had understood from Mike’s question that he was looking for an alternative to local bind mounts for local containers?

Yeah. He might. That’d be a mistake.

But for remote mounting it works well.