Running Docker in LXC (Proxmox)
Running Docker inside an LXC (Linux Container) on Proxmox is a popular way to save resources compared to running a full VM. However, it adds a layer of complexity: "Container Inception."
The Golden Rule: Enable Nesting
For Docker to run inside an LXC container, you must enable the "Nesting" feature.
In Proxmox:
- Select your LXC container.
- Go to Options -> Features.
- Check Nesting.
- Restart the container.
Without this, Docker daemon will fail to start.
Privileged vs. Unprivileged
Unprivileged (Recommended)
By default, LXC containers are unprivileged (safer). Docker works fine in unprivileged containers if Nesting and keyctl features are enabled.
Privileged
If you need to access host hardware (like passing through a GPU or a USB Zigbee stick) easily, you might need a privileged container.
- Warning: This reduces security isolation. If root in the container breaks out, they are root on the Proxmox host.
Storage Drivers & ZFS
If your Proxmox uses ZFS, you might hit issues with Docker's storage driver. Docker usually prefers overlay2.
If you see errors related to storage driver or "backing filesystem is unsupported":
- The Fix: Create a dedicated volume for Docker storage.
- The Workaround: Force Docker to use the
fuse-overlayfsdriver (slower but compatible).
Edit /etc/docker/daemon.json inside the LXC:
{
"storage-driver": "fuse-overlayfs"
}
(You may need to install fuse-overlayfs package first).
Cgroups v2
Modern Docker relies on Cgroups v2. Ensure your Proxmox host is running a modern kernel (Proxmox 7/8 usually does).
If you encounter cgroup errors, verify that /sys/fs/cgroup is mounted correctly inside the LXC.
Too Much Configuration?
LXC is great for efficiency, but debugging storage drivers and cgroups can be a time sink.
Skip the configuration hell. Hostim.dev gives you a pure Docker environment that just works, with zero overhead.