Linux Containers (LXC) is a great way to increase the density of your Proxmox server. The runtime costs for containers are low, usually negligible. However, there are some drawbacks that need to be considered:
Proxmox VE uses Linux Containers (LXC) as its underlying container technology and it has low, usually negligible running expenses. However, there are some drawbacks to consider:
- Proxmox Containers can Linux distributions. Other operating systems, such as FreeBSD or Microsoft Windows, cannot be used in a container environment. See Supported Distributions
- Containers must be restricted in order to safeguard the resources available on the host. As a result, containers operate in their own namespaces. Within containers, several syscalls (userspace requests to the Linux kernel) are prohibited.
Container nesting
I use containers for testing and homelab usage. This is possible to run those containers on LXC Containers with nesting support - a much more efficient option than running full VMs. Settings this up is fairly straightforward, and for quick provisioning you can set this up as a Container Template, running your favorite Linux distribution with the container runtime tools pre-installed
Enable nesting features in the Proxmox VE Container Configuration
- Make sure the Container is shutdown
-
Locate and edit the Proxmox VE Container Configuration,
/etc/pve/lxc/<CTID>.conf
file, which stores container configuration - whereCTID
is the numeric ID of the given container.# On the proxmox host server # e.g. where my LXC ID is 101 nano /etc/pve/lxc/101.conf
-
Insert at the bottom of the file:
features: keyctl=1,nesting=1
-
Start the LXC Instance
-
Install Container runtime tools, for example, Docker
sudo apt-get update sudo apt-get remove docker docker-engine docker.io containerd runc sudo apt-get -y install apt-transport-https ca-certificates curl gnupg lsb-release curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg\] https://download.docker.com/linux/debian $(lsb\_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose #̲# Start Docker sudo systemctl enable docker
-
Confirm you can run a docker container:
docker run hello-world