Docker Volumes on TrueNAS CORE Shares

Vaclav

Administrator
Administrator
Joined
Feb 22, 2014
Messages
4
My idea was to set up an Ubuntu VM on my TrueNAS CORE 12.0-U1 box running Docker and use a share for all the persistent data. This will have many benefits like snapshots and easy access to the data. Very soon I realized that it is not as easy as it looks. Containers really often want to set their own permissions and ownerships to various files and I'm unable to configure NFS or CIFS share to allow that. Is that even possible? And is my train of thought correct? Should the approach to this problem be fundamentally different?

Thank you in advance for any tips/tricks.
 

Kris Moore

SVP of Engineering
Administrator
Moderator
iXsystems
Joined
Nov 12, 2015
Messages
1,448
Honestly, if you can wait a day or two, I'd recommend doing this on SCALE 20.12 or later. It'll have the native docker support which makes it far easier to support this type of setup, without needing to route traffic through the VM via NFS or CIFS.
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
It's not that difficult to mount a Docker dataset into the Ubuntu VM for the persistent data? It's exactly what I do, and I think it works well. If the share is writable, Docker should be able to set permissions? Sounds like SCALE will make it easier, but it can't be that difficult on FreeNAS/TrueNAS if I can do it :cool:
 

Vaclav

Administrator
Administrator
Joined
Feb 22, 2014
Messages
4
@Kris Moore, thank you for your response. SCALE will open yet another realm of possibilities.

@adrianwi, thanks for the response as well. The issue is not the mounting itself. I can mount the share inside of the VM and make it writable for all non-root users. The problem are permissions when a user from within the container tries to chown or chmod files. Would you mind sharing the appropriate line from fstab and ACL/permission settings for the dataset and share on your TrueNAS?
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
I don't think I've got anything special going on.

Docker dataset on my pool (APEpool0)

dataset.jpg


NFS share

nfs.jpg


/etc/fstab line inside the jail

Code:
IP:/mnt/APEpool0/docker /mnt/docker nfs nfsvers=3


I've got several containers running which save persistent data back to their own folder within /mnt/docker/container.
 

marshalleq

Explorer
Joined
Mar 12, 2016
Messages
82
I'm just trying to do the same thing, was thinking SMB, but actually good points are raised here. @adrianwi is using NFS which crucially supports the permissions changing that SMB doesn't if I am correct.

I'm currently considering AGAIN moving from unraid to TrueNAS because of the lack of basic file sharing options and such in the Unraid Product and a general lack of polish in these basic areas. I can't say I'm impressed with everything in TrueNAS scale yet, but it is not even version 1 yet and is looking promising.

I've ultimately decided against using the TrueNAS Scale apps, they're just too much work, unnecessarily complex and unnecessarily restrictive for what the average person needs IMO. So I figure if I put all my dockers back into a VM like I used to, this would give me portability between any system. Something that docker / Kubernetes doesn't really make easy when you have a lot of them installed directly on a NAS host.

So I think running in a VM is actually quite a good option. Hopefully I can find a nice GUI to manage the containers in the VM remotely also.
 
Top