العربية

Docker on Proxmox: LXC Container or VM? Setup Guide

Last updated: November 28, 2026

Docker running in a Proxmox LXC container or a virtual machine

Two places to run Docker on Proxmox, and how they differ.

Proxmox VE gives you two places to run Docker: inside an LXC container or inside a virtual machine. Both work. They differ in isolation, in the settings you must change, and in what happens when you move or back up the guest. This guide compares them using the Proxmox documentation, then shows the commands for each, with a small docker compose file to test.

If you are still deciding which apps belong on Proxmox at all, start with our guide to self-hosted apps that run better on Proxmox than Docker. This article covers the next step: where to put Docker itself.

Table comparing Docker in a Proxmox LXC container with Docker in a Proxmox VM by kernel, isolation, required settings, migration and guest OS

Docker in an LXC container compared with Docker in a VM.

How an LXC Container and a VM Differ

⚡ Quick Answer: Run Docker in an unprivileged LXC container with nesting and keyctl enabled when you trust the images and want low overhead. Use a VM for untrusted or internet-facing workloads, live migration, or your own kernel. Proxmox says VMs isolate better and recommends against privileged containers for this job.

Proxmox describes containers as a lightweight alternative to fully virtualized machines. A container uses the kernel of the host instead of emulating a whole operating system, so its runtime cost is usually negligible. The trade-offs, in Proxmox's words, are that only Linux distributions can run in a container, and that access to host resources is restricted through separate namespaces and blocked system calls.

A VM has its own kernel and virtual hardware. That costs more memory and CPU, but it is a stronger boundary. The Proxmox documentation says that because containers share the host kernel, they expose an attack surface, and that in general full virtual machines provide better isolation. It names containers given to unknown or untrusted people as the case where that matters.

LXC containerVirtual machine
KernelShares the Proxmox host kernelHas its own kernel
IsolationNamespaces, AppArmor and seccomp. Proxmox says VMs isolate betterFull virtualization
Docker needsnesting and keyctl features, unprivileged container recommendedNothing special, install Docker as on any Linux server
Moving it between nodesNo live migration. A restart migration shuts down, moves and starts itLive migration is possible
Guest OSLinux onlyLinux, Windows and others
OverheadUsually negligible, per ProxmoxFull OS plus virtual hardware

Docker in an LXC Container

This section covers the container route: why its settings matter, then the commands to create it.

Why the container settings matter

New containers are unprivileged by default. In an unprivileged container, root inside the container is mapped to an ordinary user on the host, so most escape problems affect that user and not the host. Proxmox says the LXC team thinks unprivileged containers are safe by design. Privileged containers are the opposite: the LXC team considers them unsafe and will not treat new escape bugs as security issues worth a quick fix. Keep them for trusted environments only.

Docker needs two features. According to the Proxmox container reference, keyctl allows the keyctl() system call, which is required to use Docker inside an unprivileged container. nesting allows nested containers and exposes the host's procfs and sysfs contents to the guest, so enable it only on the container that needs it.

Create the container

Download a Debian system template, then create the container. The names in angle brackets are yours to fill in. The syntax follows the Proxmox pveam and pct examples.

Proxmox host shell
pveam update
pveam available --section system
pveam download local <template-name>

pct create 200 local:vztmpl/<template-name> \
  -hostname docker-lxc -cores 2 -memory 2048 \
  -rootfs local-lvm:16 \
  -net0 name=eth0,bridge=vmbr0,ip=dhcp \
  -unprivileged 1 -features nesting=1,keyctl=1

pct start 200
pct enter 200

Here local-lvm:16 allocates a new 16 GiB root volume on the storage called local-lvm. Change the ID 200, the storage name and the bridge to match your server. If the container already exists, you can add the features later with pct set 200 -features nesting=1,keyctl=1 and restart it.

Docker in a Virtual Machine

A VM needs no special flags. Create it in the web interface with a Debian or Ubuntu Server ISO. Proxmox suggests ticking the QEMU Agent box if you plan to install the QEMU guest agent, because it lets Proxmox show more information and handle actions such as shutdown and snapshots more intelligently. Then install the agent inside the guest and continue with the Docker steps below.

Inside the VM (Debian or Ubuntu)
sudo apt install qemu-guest-agent
sudo systemctl enable --now qemu-guest-agent

Install Docker and Test It

The steps are the same in the container and the VM. Add Docker's apt repository and install the packages as described in the Docker Engine install guide for Debian, which includes the docker-compose-plugin package. Then check the install:

Inside the guest
sudo docker run hello-world

For a real test, save the compose file below as compose.yaml. It is the example from the Uptime Kuma project, a self-hosted uptime monitor. The image tag and options come from that project, so check its page for the current ones before you rely on them.

compose.yaml
services:
  uptime-kuma:
    image: louislam/uptime-kuma:2
    restart: unless-stopped
    volumes:
      - ./data:/app/data
    ports:
      - "3001:3001"
Inside the guest
docker compose up -d
docker compose ps

Open http://<guest-ip>:3001 in a browser to finish setup. The data folder sits next to the compose file, so it lives on the guest's own disk.

Backups, Snapshots and Moving the Guest

Proxmox backs up containers with vzdump and restores them with pct restore. Because Docker keeps its data on the container's root disk in the setup above, one backup of the container captures Docker and its volumes together. The same reasoning holds for a VM disk. Bind mounts are different: Proxmox says they are not managed by the storage subsystem, so you cannot snapshot them or apply quotas to them from inside the container, and they are never included in backups.

Moving is where the two differ most. Proxmox says running containers cannot be live-migrated because of technical limitations. A restart migration shuts the container down, moves it and starts it again on the target node, and Proxmox says that because containers are lightweight this normally means a downtime of only some hundreds of milliseconds. A VM can be live-migrated, as long as the CPU types of the nodes are compatible.

What About Proxmox OCI Support?

Recent Proxmox VE versions can also create containers straight from OCI images, the same format Docker images use. Proxmox labels these application containers as a technology preview. It also states that for maximum isolation and the ability to live-migrate, nesting containers inside a Proxmox QEMU VM remains a recommended practice. Treat OCI support as something to try on a test node, not as a replacement for the setup above yet.

Planning Resources and Storage

Before you create anything, decide how much of the host the guest gets. A container only takes what it uses, because it shares the host kernel. A VM reserves its memory and runs a full operating system, so it costs more RAM at idle. Both let you set CPU cores and memory when you create them, as the commands in this guide show.

Where Docker keeps its data

Docker writes images and volumes to the guest's own disk unless you point it elsewhere. That is why one Proxmox backup of the guest captures everything in the simple setup above. Mount a separate disk or a bind mount only when you have a reason, and remember what Proxmox says about bind mounts: they sit outside the storage subsystem, so no snapshots, no quotas and no backups for that data.

Sizing a first guest

The examples use 2 cores, 2048 MiB of memory and a 16 GiB disk. That is a starting point for one or two small services, not a recommendation for every workload. Watch real usage in the Proxmox web interface for a week, then resize. Proxmox lets you change these values later, so there is no need to guess large.

Common Mistakes to Avoid

Most problems with Docker on Proxmox come from the choices above, not from Docker itself. These are the ones the Proxmox documentation points toward.

  • Using a privileged container to make Docker work. Turn on nesting and keyctl in an unprivileged container instead.
  • Leaving nesting on for every container. Proxmox notes it exposes the host procfs and sysfs contents to the guest, so enable it only where needed.
  • Assuming bind-mounted data is backed up. It is not, according to Proxmox.
  • Expecting live migration for a container. Only a restart migration is available.
  • Copying a compose file without checking its image tag. Projects change tags, so read the project page first.

When you are ready to look at the wider picture, our comparison of VMware and Proxmox explains where each platform fits, and the Windows Server 2025 lab guide for Hyper-V, VMware and Proxmox shows Proxmox next to its alternatives.

❤️

Support Our Content

Your donation helps us keep going

Which One Should You Pick?

  1. Trusted apps on one home server: an unprivileged LXC with nesting and keyctl. You save memory and get fast start-up.
  2. Public-facing services or images from sources you do not know: a VM. The extra RAM buys a stronger boundary.
  3. A cluster where guests must move without stopping: a VM.
  4. An app that needs its own kernel modules or drivers: a VM.

Frequently Asked Questions About Docker on Proxmox

❓ Can I run Docker in a Proxmox LXC container?

Yes. Use an unprivileged container and enable the nesting and keyctl features when you create it or later with pct set. The Proxmox reference says keyctl is required to use Docker inside an unprivileged container, and nesting allows the nested containers Docker creates.

❓ Is Docker in a VM safer than Docker in an LXC container?

Proxmox says full virtual machines generally provide better isolation than containers, because containers share the host kernel and so expose an attack surface. A VM is the safer choice for untrusted images, internet-facing services and any workload you cannot fully vouch for.

❓ Can I live-migrate a Docker LXC container?

No. Proxmox says running containers cannot be live-migrated because of technical limitations. You can do a restart migration, which shuts the container down, moves it and starts it on the target node, with a short downtime. A VM can be live-migrated if node CPUs are compatible.

❓ Should I use a privileged container for Docker?

No. The LXC team considers privileged containers unsafe by design, and Proxmox recommends them only for trusted environments. Keep the container unprivileged and turn on the nesting and keyctl features instead. That combination is the documented way to run Docker without giving root inside the guest real root on the host.

❓ Do I need a template to create an LXC container?

Yes. You download a container template with pveam, then create the container from it with pct create. Proxmox lists the available system templates with pveam available, so you pick a Debian one and note its exact name before running the create command.

❓ Does Docker in a VM need any special Proxmox setting?

No special flag is needed. Install Docker as you would on any Linux server. Proxmox suggests enabling the QEMU Agent option and installing the guest agent, so the host can show more information and handle shutdown and snapshots more intelligently for that guest.

Conclusion and Next Steps: Choosing Between LXC and a VM

Docker works well on Proxmox in both places. An unprivileged LXC container with nesting and keyctl is the light, fast choice for trusted home lab apps. A VM costs more memory but gives stronger isolation and live migration. Avoid privileged containers.

Your next step: pick the guest type from the list above, create it with the commands shown, and run the Uptime Kuma compose file as a test. Then take a backup before you add real services.

📬
Home Lab and Proxmox Guides

Get Home Lab Guides That Actually Work

Practical Proxmox, Docker and self-hosting guides based on official documentation and delivered to your inbox from Valley4Techs.

🔒 100% free. No spam, ever. Unsubscribe with one click anytime.

Sources

Add Valley4Techs as a Preferred Source

Follow us on Google News for the latest updates

Add Now
Comments