Docker in Proxmox LXC: Nesting, keyctl, ZFS and Fixes (2026)
To run Docker inside a Proxmox LXC container, enable two features on the container: nesting and keyctl. On the Proxmox host run pct set <CTID> -features nesting=1,keyctl=1 and restart the container. Then install Docker inside it from Docker's apt repository. Use an unprivileged container. On ZFS, Proxmox VE 8.1 and newer (OpenZFS 2.2+) support Docker's default overlay2 driver, so fuse-overlayfs is no longer needed.
Docker in LXC uses less RAM and starts faster than Docker in a VM. The cost is a shared kernel and more things that can break on a host update. Proxmox itself recommends a VM for Docker. This page shows both sides and the exact setup.
LXC vs Docker: what is the difference?
Both use the same Linux kernel features (namespaces and cgroups). They are built for different jobs.
| LXC | Docker | |
|---|---|---|
| Runs | A full Linux system: init, systemd, SSH, cron | One application process |
| Image | A distribution template (Debian, Ubuntu, Alpine) | An application image (nginx, postgres) |
| Updated by | apt upgrade inside the container | Pulling a new image and recreating the container |
| Config | /etc/pve/lxc/<CTID>.conf on Proxmox | compose.yaml |
| Feels like | A light VM | A packaged app |
So "Docker in LXC" means: an LXC system container acts as the host, and Docker runs application containers inside it.
Docker in LXC or in a VM?
| Docker in LXC | Docker in a VM | |
|---|---|---|
| RAM overhead | Very low | The guest kernel and OS, a few hundred MB |
| Isolation | Shares the Proxmox kernel | Own kernel |
| Host updates | Can break Docker (it happened in November 2025, see below) | Do not affect Docker |
| Live migration | No | Yes |
| GPU, USB passthrough | Bind device nodes, often privileged | PCI passthrough |
| Proxmox's advice | Not recommended for Docker | Recommended |
Use LXC on a small home server where RAM is tight and you can fix things after an update. Use a VM for anything other people depend on.
Proxmox VE 9.1 can also create an LXC container straight from an OCI image (technology preview). That runs one image as a system container. It is not Docker: there is no Docker CLI and no Compose, and you recreate the container to update it.
Step 1: Create the container
In the Proxmox web UI, Create CT:
- Keep Unprivileged container checked.
- Check Nesting.
- Template: Debian 13 or Ubuntu 24.04.
- Disk: at least 16 GB. Docker images fill it fast.
Step 2: Enable nesting and keyctl
On the Proxmox host shell:
pct set 101 -features nesting=1,keyctl=1
pct reboot 101
Replace 101 with your container ID. The same setting is in Container → Options → Features in the web UI, or as one line in /etc/pve/lxc/101.conf:
features: keyctl=1,nesting=1
- nesting lets Docker create its own namespaces and mount
/procand/sysinside the container. Without it, the Docker daemon does not start. A container with a new systemd also printsWARN: Systemd 257 detected. You may need to enable nesting.at start. - keyctl lets processes in an unprivileged container use the kernel keyring. Docker and runc need it.
Step 3: Install Docker inside the container
Open a shell in the container (pct enter 101) and install Docker Engine and the Compose plugin from Docker's apt repository. The full steps for Debian and Ubuntu are in Install Docker Compose. Short version for Debian:
apt-get update && apt-get install -y ca-certificates curl
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
cat > /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/debian
Suites: $(. /etc/os-release && echo "$VERSION_CODENAME")
Components: stable
Signed-By: /etc/apt/keyrings/docker.asc
EOF
apt-get update
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Check that it works:
docker run --rm hello-world
docker info --format '{{ .Driver }}' # overlay2 or overlayfs is good; vfs is slow
Storage: overlay2 on ZFS
Docker's default storage driver needs overlayfs. OpenZFS added overlayfs support in version 2.2, and Proxmox VE 8.1 ships it. On Proxmox VE 8.1 or newer, Docker in an LXC on a ZFS dataset uses overlay2 with no extra setup.
On older Proxmox, Docker falls back to the vfs driver (very slow, full copy per layer) or fails with backing filesystem is unsupported. Fix it in this order:
- Update Proxmox to 8.1 or newer.
- Or give the container a mount point on non-ZFS storage (ext4 or LVM-thin) for
/var/lib/docker. - Or, last choice, install
fuse-overlayfsin the container and set{"storage-driver": "fuse-overlayfs"}in/etc/docker/daemon.json.
Check your ZFS version on the host with zfs version.
Mount host storage into Docker
Add a bind mount from the host to the container, then mount that path into Docker as usual:
# On the Proxmox host
pct set 101 -mp0 /tank/media,mp=/mnt/media
# compose.yaml inside the container
services:
jellyfin:
image: jellyfin/jellyfin
volumes:
- /mnt/media:/media:ro
In an unprivileged container, user IDs are shifted by 100000. UID 1000 in the container is UID 101000 on the host. If the app gets "permission denied" on the mount, give the host folder to the shifted ID:
# On the Proxmox host, for UID/GID 1000 in the container
chown -R 101000:101000 /tank/media
For more on Docker volumes, see Docker Compose volumes.
Privileged or unprivileged?
Use unprivileged. Root in an unprivileged container maps to an unprivileged user on the host. In a privileged container, root in the container is root on the host, so a container escape gives full control of Proxmox.
A privileged container is only easier for device access (a GPU, a USB Zigbee stick). Even then, try device passthrough in an unprivileged container first (Resources → Add → Device Passthrough in Proxmox VE 8.2 and newer).
Troubleshooting
open sysctl net.ipv4.ip_unprivileged_port_start file: reopen fd 8: permission denied
Every container fails to start with this error. It started in November 2025, when a runc security fix (CVE-2025-52881, shipped in containerd.io 1.7.28-2) clashed with the AppArmor profile Proxmox uses for LXC.
Fix: update the Proxmox host. lxc-pve 6.0.5-2 and newer contain the patch.
# On the Proxmox host
apt update && apt full-upgrade
pct reboot 101
Do not downgrade containerd.io inside the container. That removes the security fix. If you cannot update the host, lxc.apparmor.profile: unconfined in /etc/pve/lxc/101.conf also works, but it removes AppArmor protection from the container.
Docker daemon does not start
Run journalctl -u docker -n 50 inside the container. Errors that mention mount, proc or cgroup mean nesting is off. Errors that mention keyring or permission denied at start mean keyctl is off. Set both and reboot the container.
Cgroup errors
Proxmox VE 8 and 9 use cgroup v2. Docker 20.10 and newer support it. If you see cgroup errors, your Docker inside the container is too old. Install the current version from Docker's repository, not docker.io from an old distribution.
Very slow builds and huge disk use
docker info shows Storage Driver: vfs. See the ZFS section above.
Skip the host
Proxmox, LXC features, AppArmor and storage drivers are a lot to maintain for one app. On Hostim.dev you deploy the same compose.yaml and we run the host.
Frequently asked questions
How do I run Docker in a Proxmox LXC container?
Create an unprivileged container, enable the nesting and keyctl features (pct set <CTID> -features nesting=1,keyctl=1 on the host, then reboot the container), and install Docker Engine inside it from Docker's apt repository. Test with docker run --rm hello-world.
What is the difference between LXC and Docker?
LXC runs a full Linux system with init, systemd and a package manager, like a light VM. Docker runs one application from an application image and is managed with docker and compose.yaml. Both use the same kernel features. On Proxmox you can run Docker inside an LXC container.
Should I run Docker in an LXC or in a VM on Proxmox?
Proxmox recommends a VM for Docker. A VM has its own kernel, so host updates do not break Docker, and it supports live migration. LXC uses less RAM and starts faster, which suits a small home server where you can fix things after an update.
Why do I need nesting and keyctl for Docker in LXC?
nesting lets Docker create its own namespaces and mount /proc and /sys inside the container. Without it the Docker daemon does not start. keyctl lets processes in an unprivileged container use the kernel keyring, which Docker and runc need.
Does Docker work in LXC on ZFS?
Yes, on Proxmox VE 8.1 and newer. They ship OpenZFS 2.2, which supports overlayfs, so Docker uses its default overlay2 driver. On older versions Docker falls back to the slow vfs driver; update Proxmox or put /var/lib/docker on ext4 or LVM-thin storage.
How do I fix 'reopen fd 8: permission denied' for Docker in Proxmox LXC?
Update the Proxmox host with apt update && apt full-upgrade and reboot the container. lxc-pve 6.0.5-2 and newer fix the clash between the runc security fix for CVE-2025-52881 and the Proxmox AppArmor profile. Do not downgrade containerd.io inside the container.