VM, LXC, or Docker container
"Should I run this in a VM, an LXC container (Linux system container that shares the host kernel), or Docker?" is a standing question in self-hosting forums, and it's a category error disguised as a deployment choice. I asked it myself for years, badly. It treats three different things as competitors: one is an isolation boundary, one is a lightweight operating system instance, and one is a packaging format. The day that clicked, most of my placements stopped being decisions and started being consequences.
What each one is
A VM is a kernel boundary. QEMU/KVM (a machine emulator paired with the Linux kernel's built-in virtualization) gives the guest its own kernel and virtual hardware; guest code talks to that kernel and reaches the host only through the virtualization layer. That's the strongest isolation a hypervisor (software that runs and isolates virtual machines) hands out, and it's the boundary I reach for when I want to stop thinking about a workload's neighbors. It runs Linux, Windows, or BSD and can be live-migrated (moved between hosts without shutting down the guest) between compatible nodes while running.
An LXC container is a system container. A full distribution userland (operating-system programs and libraries outside the kernel) with its own init, administered like a small server, that shares the host's kernel. It boots in moments and carries no second kernel, no QEMU device model, and no per-guest page cache duplication. Proxmox creates them unprivileged by default: root inside maps to an unprivileged user outside, layered under AppArmor, seccomp, and cgroup limits (Linux mechanisms for access policy, system-call filtering, and resource limits). That's real risk reduction, and I still never let myself forget that the shared kernel stays shared.
A Docker container is a packaged application. One service and its dependencies, built as an image and designed to be thrown away and rebuilt from a new image. Under the hood it uses the same kernel primitives LXC uses (namespaces (kernel feature that isolates process views of the system), cgroups, seccomp) with different defaults; the difference that matters is lifecycle. LXC asks "how do I run another Linux?", Docker asks "how do I ship this app?". I spent an embarrassing amount of time comparing them on isolation before noticing they answer different questions.
How I decide
Four criteria carry nearly all the weight.
Trust and the kernel boundary. Proxmox's own documentation says it plainly: containers expose host-kernel attack surface, and full VMs provide better isolation for unknown or untrusted users. I do not argue with that sentence; I've read enough container-escape writeups not to test it personally. Anything internet-exposed, anything running semi-trusted code, anything whose compromise must not matter to its neighbors gets a VM. Unprivileged LXC is for services I trust and merely want cheap.
High availability and maintenance. This one is underrated until you have to empty a node with guests still running. A running VM with migratable resources live-migrates between compatible hosts without shutting down. A running LXC container can't; Proxmox only offers restart migration, which shuts the container down, moves it, and starts it again. The docs put the usual downtime at a few hundred milliseconds, but a container that won't shut down cleanly hits the 180-second default timeout before it's killed, so it's always an interruption I schedule around. Services that must glide through planned maintenance therefore live in VMs. When a node dies, HA (automatic restart of guests on another node after failure)-managed guests of both types restart elsewhere once the dead node is fenced (isolated from shared resources before recovery starts): HA is automatic recovery, never zero downtime.
Backup and restore granularity. Both VMs and LXC containers back up to Proxmox Backup Server as full restorable guests: VMs at block level with live restore, containers at file level, where snapshot mode needs snapshot-capable storage. Docker is different: rebuilding a container from its image brings back the application, and you still need a separate plan for the data in its volumes. The only restores that went badly for me were the ones where I hadn't decided which recovery path I was counting on before the disk died.
Overhead. Every VM pays for its own kernel, its services, and its memory; ballooning (dynamic reclaim of unused guest memory back to the host) softens this but needs a balloon driver in the guest. Containers share the host kernel and pack far denser. On shared hardware that's real money, and it's the budget the trust criterion spends. Asking only "which is lighter?" is benchmark-brained nonsense; the useful question is whether the workload is worth a kernel of its own.
Where Docker goes
Proxmox's FAQ recommends against running Docker directly on the host, and I
consider doing it anyway avoidable operational sabotage. Docker writes
firewall rules for its bridges, spawns cgroups per container, and runs a root
daemon, all on the machine whose whole job is predictability. The conservative
pattern, and the one used here, is host, then VM, then Docker: application
containers share the VM's kernel, and the hypervisor never runs a Docker
daemon. Docker inside LXC can be made to work (I tried, twice), but it stacks
namespace layers on the same host kernel and usually means loosening the
container to get there; the nesting feature, for one, exposes host procfs
and sysfs contents to the guest. It's a trade to make knowingly or not at all,
and I made it unknowingly once.
Since 9.1, Proxmox VE can also convert OCI images (standardized container images that multiple runtimes can consume) into LXC guests, running application containers without a Docker daemon. The docs still label application-container support a technology preview; it inherits LXC semantics including restart-only migration, and it doesn't change the placement logic above yet.
Full disclosure: I almost always skip Docker
The flowchart above is the sober version. In practice, when a workload could go either way, Docker almost never wins here. Two reasons, neither flattering.
I'm too dumb for it. For operating the result, anyway. A running Docker
host accumulates state in more places than I can keep in my head: images,
layers, volumes that outlived their containers, networks, iptables chains the
daemon rewrote, and a compose file that no longer quite matches reality. Every
one of those is knowable; all of them at once, during an outage, is a fucking memory test I keep failing (docker volume ls -f dangling=true). A
systemd service is one unit file and one journalctl -u away from its logs;
an LXC container behaves like every Linux server I've administered since the
beginning. Tools are supposed to reduce what a person holds in their head. For
my workloads, Docker increases it.
I just don't like it. The default daemon runs as root and acts like it (rootless mode exists, but the default is what ships), images are a supply chain audited by nobody in this room, and the ecosystem's habit of answering "how do I run this?" with a 40-line compose file has trained upstreams to hand their complexity to the user. Docker is good engineering for a problem I mostly don't have. That's a preference, and the behavior above is why I hold it.
That's why the Docker VM from the flowchart exists: for third-party apps that are only seriously distributed as images, where repackaging by hand is a worse use of a life than accepting the compose file. They earn their place by being someone else's packaging problem, and the VM keeps their daemon, bridges, and firewall rules off the hypervisor.
How that plays out here
Role-level examples from this setup, one per pattern:
- The PR review bot runs agent CLIs against untrusted pull-request content: own VM, without discussion.
- Dependency-heavy third-party apps that ship as compose files run in Docker, inside a VM that exists to hold them.
- Small trusted single-purpose services that want their own Linux userland sit in unprivileged LXC containers, dense and cheap; smaller trusted tools that don't need a separate OS instance run as plain systemd services inside an existing guest.
The rule behind all three placements is the one from the role-level note: every workload gets the cheapest boundary that still isolates it.