Yorick
Wizard
- Joined
- Nov 4, 2018
- Messages
- 1,912
After some experimentation, I have Ubuntu 20.04 working with docker and an NFS mount on TrueNAS Core 12.0-U8.1
On TrueNAS, configure the NFS service to support "NFSv4" and use "NFSv3 ownership model", and start it. If it was already started, stop and start it.
Create a dataset. 16kb recordsize can be prudent if you are going to run DB workloads in docker.
Configure an NFS share for that dataset and set "Maproot User" to "root", "Maproot Group" to "nogroup". "All dirs" if you like, and "Enabled". I also added my network under "Authorized Networks", but that doesn't sound necessary.
On Ubuntu
Install prerequisites:
Stop docker services:
Create a directory to mount into:
Add a line to fstab:
Where you'll set TRUENAS-IP to the IP address of TrueNAS Core and /mnt/poolname/dataset to the path you used for the NFS share
Test it works:
Provided it got mounted, copy the docker files over:
Rename the old docker file location:
Create a docker configuration file:
and place into it:
Lastly, start docker again:
I tried to test performance with
Once you are happy that everything is working the way you want it to you can remove the old docker files,
On TrueNAS, configure the NFS service to support "NFSv4" and use "NFSv3 ownership model", and start it. If it was already started, stop and start it.
Create a dataset. 16kb recordsize can be prudent if you are going to run DB workloads in docker.
Configure an NFS share for that dataset and set "Maproot User" to "root", "Maproot Group" to "nogroup". "All dirs" if you like, and "Enabled". I also added my network under "Authorized Networks", but that doesn't sound necessary.
On Ubuntu
Install prerequisites:
sudo apt update && sudo apt -y install nfs-common fuse-overlayfs
Stop docker services:
sudo systemctl stop docker && sudo systemctl stop docker.socket
Create a directory to mount into:
sudo mkdir -p /mnt/NFS
Add a line to fstab:
TRUENAS-IP:/mnt/poolname/dataset /mnt/NFS nfs nfsvers=4,rsize=1048576,wsize=1048576,timeo=14,intr 0 0
Where you'll set TRUENAS-IP to the IP address of TrueNAS Core and /mnt/poolname/dataset to the path you used for the NFS share
Test it works:
sudo mount -av
Provided it got mounted, copy the docker files over:
sudo cp -rp /var/lib/docker /mnt/NFS
Rename the old docker file location:
sudo mv /var/lib/docker /var/lib/docker.old
Create a docker configuration file:
sudo vi /etc/docker/daemon.json
and place into it:
Code:
{ "data-root": "/mnt/NFS/docker", "storage-driver": "fuse-overlayfs" }
Lastly, start docker again:
sudo systemctl start docker
I tried to test performance with
sudo fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=/mnt/NFS/test --bs=4k --iodepth=64 --size=150G --readwrite=randrw --rwmixread=75 && sudo rm /mnt/NFS/test
and that didn't go anywhere in a hurry. I then tried it with a 4G file and got r/w IOPS of 3900/1300, which is pretty terrible for SSD-backed storage. A speed daemon this ain't.Once you are happy that everything is working the way you want it to you can remove the old docker files,
sudo rm -rf /var/lib/docker.old