Logo

Armand.nz

Home / About / Linkedin / Github

Nesting containers in a Promox LXC

#proxmox |

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:

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

  1. Make sure the Container is shutdown
  2. Locate and edit the Proxmox VE Container Configuration, /etc/pve/lxc/<CTID>.conf file, which stores container configuration - where CTID 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  
    
  3. Insert at the bottom of the file:

    features: keyctl=1,nesting=1  
    
  4. Start the LXC Instance

  5. 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  
    
  6. Confirm you can run a docker container:

    docker run hello-world
    
comments powered byDisqus

Copyright © Armand