Hey everyone! I'm running Docker Swarm on Proxmox, specifically inside an LXC container acting as the swarm manager. I've set up a bind mount from Proxmox to the container at "/srv/containers" where I create folders for my services like traefik and portainer that are then bound to those specific containers.
Now, I've added a second Proxmox server with another LXC container as a worker node. I need a reliable way to sync the "/srv/containers" directory from the manager to the worker so that I can freely move containers between the two. I've already tried using NFS, but I've been hitting permission issues with rootless containers, especially with Postgres trying to chown folders. I've spent a week on possible solutions, but nothing has worked for me.
I've also heard about GlusterFS but found mixed reviews regarding its compatibility with rootless containers, as they seem to have similar permission issues. What do you all recommend for syncing folders between these nodes? I'm open to any solution!
Just an update: I've switched from LXC to a minimal Debian 12 setup for running Docker, which has resolved the permission problems. I found that GlusterFS works well but has high CPU usage. Currently, I'm using Syncthing to sync the necessary folders across my nodes, and it detects file changes within seconds, which works for my needs.
2 Answers
Have you tried disabling root squashing on your NFS server? You can set `no_root_squash` in the exports. This should help with the rootless container permissions. Another option could be using Docker's user namespace remapping feature to completely avoid using root. Just keep in mind that this needs to be set up right after you install Docker to avoid permission issues later.
It seems like the best practice is to avoid using root at all in your images. Even if you start as root and then switch down to lower privileges, it can still pose risks. A lot of people are shifting away from root in their container environments to prevent these kinds of issues.
Related Questions
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically
[Centos] Delete All Files And Folders That Contain a String