LXC and Docker Configurations on ZFS best practices?

uqtdev

New Member
Jul 11, 2024
1
0
1
17
I've been playing around with ZFS and bind mounting datasets and their sub directories to LXC containers to be able to use my storage directly, to be able to manage data for different services independently of the containers running the actual service, but I'm still struggling to keep everything organized and decide on what's the best way to actually do this.

Are there preferable ways that don't involve directly mounting to the host?

Also, Databases. Usually I would just contain the database within a dataset directly or a sub-directory, and mount that to the lxc, and manually change the dataset, but now I'm thinking should I mount them directory to the lxc's equivalent database directory to simplify it?

Datasets too, Usually I create one when I think it's worthwhile for snapshots, and for large media/data storage like jellyfin and nextcloud (for reservations and quotas generally), but I know each dataset has a lot of individual options. I'm thinking I should not make more than I need, and use sub-datasets pretty much entirely for quotas?

For docker apps, I'd have a dedicated dataset where i'd have sub-directories containing the docker compose and related docker volumes, but some docker apps don't seem to play well with this, and it's awkward mounting them, is there a preferred way to do this, or just in a /mnt/ directory?

After thinking through, Here's what I think might be best for the datasets

zfs/databases - subdirectories for different db types and then database directories. those directories would be directly mounted to the related database directory in the containers to make switching out and putting in those databases just one line of configuration (aswell as creating new ones would be the exact same)
zfs/nextcloud_data
zfs/content_media/tv -
media directory would be used to set an overall limit on all of the media, since one zfs is used for all
zfs/content_media/movies
zfs/content_media/music
zfs/service_data/matrix_images -
would be default mounted to the default images directory
zfs/service_data/webserver
zfs/service_data/docker -
subdirectories would be mounted to LXCS

I'm still quite an amateur, but does this look sensible? Are there things that I'm missing or straight up doing wrong? This also doesn't really account for configuration files, like with matrix, though that I'm less concerned about, as those never change. I do plan on doing more with tools like ansible and terraform, and I would imagine that would be a fine way to set static configurations.
 
The question is whether you really want to organize it that way at low level...?
As you suggest, I would use Docker directly on the host without LXC. That would work, but then it has nothing to do with virtualization.

I also have a lot of Docker containers running. But not on a dataset but on a VM basis.

e.g.
An Ubuntu 22.04 VM with Portainer. There the applications for this network/zone run in a compose.
The big advantage: The whole VM can be backed up with a Proxmox backup task and you don't run into any LXC issues in connection with Docker which occur again and again. In my opinion, LXC is not the right tool for this.
 
  • Like
Reactions: Kingneutron

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!