Don't use local Docker Volumes

preview_player
Показать описание
How to avoid using local Docker Volumes and connect them to a remote NFS Storage Server like QNAP, Synology, etc.? I will show you how to create NFS Docker Volumes in Portainer and connect them to my TrueNAS server. #Docker #Linux #Portainer

Follow me:

Timestamps:

00:00 - Introduction
01:17 - Why not store Docker Volumes locally?
03:03 - What is an NFS Server
03:30 - Advantages of NFS Servers
04:29 - What to configure on your NAS?
06:02 - Advertisement-*
06:35 - Create NFS Docker Volumes
11:02 - Migrate existing Volumes to NFS

________________
All links with "*" are affiliate links.
Рекомендации по теме
Комментарии
Автор

Brilliant! I was just looking at something like this today, but instead I was trying mounting my synology as a cifs volume, nfs is so much easier and this video helped me set it up under 5mins. Thank you!

NathanFernandes
Автор

I followed this for my WindowsNAS to share to docker and this is so much easier then doing host level mounts. Thank you soo much

ColoredBytes
Автор

Btw, one point I need to add here: doesn’t mean you don’t need to have backups. Having redundant storage over NFS is nice. But do ensure you still have restorable backups in addition to this.
There can be many things that can go wrong here, your FS might get corrupt in case there was a network problem while writing a bit or the raid fails etc etc.

ninadpchaudhari
Автор

Some food for thought...
Most NAS systems have 2 network interface. You could attach the NAS directly to the server on a separate VLAN and optimize that network for I/O, enabling jumbo frames etc. That basically makes it a SAN without the redundancy.

Using iSCSI instead of NFS is also an option and might be preferred for database workloads I assume.

HoshPak
Автор

Great walkthrough and howto. Thanks for that. Nevertheless, small criticism at this point. NFS volumes and snapshot backups on the target NAS IMHO do not replace an application-based backup. Of course (for example in the event of a power failure but also due to other technical and organizational problems) the volumes on the NFS can be destroyed and become inconsistent in the same way as those on the local machine. This is even more likely because the writing process on the NFS relies on more technical components. That's why I also do and highly reccomend application-based backups with at least the same frequency. If the application's backup algorithm is written sensibly, it will only complete the backup after a consistency check and then it is clear that at least this backup is not corrupted and can be restored without data loss.

MichaelWDietrich
Автор

I wish I found this video last week. It would have saved me hours trying to mount a NFS share on my Ubuntu server. I ran into the user permission issue also and it took a lot of searching to find the answer.

blairhickman
Автор

This was awesome. Perfect timing as exactly the next step I wanted to make with my volumes on Portainer.

anthonyjhicks
Автор

Exactly what I was looking for! Great video! Would love to see it done all via CLI also

Theeporkchopexpress
Автор

this is great to know -i am currently looking into how to back up my more info sensitive docker containers -like vaultwarden or nextcloud -great video

ilco
Автор

When migrating cp -ar maybe better as it copies permissons, too. Nice video! Need to figure out how to do this in docker-compose.

marcoroose
Автор

I have been stuck for weeks with an nsf volume not mounting right inside my containers. First I couldnt edit the created files. Then I could but couldn't create new ones. This fixed both my issues thanks going to set up my shares like this moving forward.

GSEISLSE
Автор

You can also run docker containers in TrueNas itself and connecting to the NFS locally. If I'm right the writes can then handled synchroniously. This gurantees the data integrity.

ercanyilmaz
Автор

Glusterfs works really well for small files or small file transfers as well.
Edit: I've since been told databases don't scale well on glusterfs. IDK how much experience that person has with glusterfs but they have enough experience with k8s for me to accept it until I can test it. Works great for the really small stuff I do in my home lab though.

haxwithaxe
Автор

Hey! Thank you very much for this.
Can you also give an example on how to use an NFS mount in docker-compose / Stacks in Portainer? I've spent the last couple of hours trying and googling but wasn't able to find a real answer or constant examples on how to do it.

fx_
Автор

I am triggered into high gear learning mode by all of this. The aim is to set up a home assistant server. ha runs in docker and stores its data in local volumes. I am no fan on having my data all over the place so this video solves that problem. So next step is to get my hands dirty and hope i do not get to many errors that exceed my domain of knowledge. Thanks!!

ronaldronald
Автор

@christianlempa is the activation of NFS4 that simple?? I've tried exactly what you deed and the mount fails returning "permission denied", always. I tried to dig on the subject and looks like that NFS4 requires a lot of effort to get working.

rodrigocsouza
Автор

Many of the big datacenter also use Fibre channel based storage, network attached can be slow and subject to tcp congestion and package loss, whereas fc is guaranteed delivery.

jmatya
Автор

isnt it better to map the NFS volume in a /mnt/NFS on the host running docker so you have 1 connection open instead of hunderds for every container picking its own connection? Or is that not possible when you go docker swarm?

kanarie
Автор

I am having issues installing a stack in a Volume. the volume is already added in portainer and I see it and Tested it but my yml I cant figure out how to add nextcloud to the volume I want it.

Billyfelicianojp
Автор

it's the same thing. a storage server can also crash. and you have a complicated setup with a NAS storage. either methods you select, a proper backup is best.

rinony