Proxmox is a fully-featured platform for virtualization, using both virtual machines and containers. With Proxmox, you have a variety of containers to choose from. However, LXC containers are the underlying container technology of the platform. You can install Docker containers as well on a Proxmox host system. How can you do that with Proxmox containers? We take note of a couple of ways.
Table of Contents
Proxmox Container vs. Virtual Machine
Proxmox can run containers and virtual machines. There is an age-old debate about containers vs virtual machines outside the realm of Promox. However, like any technology, they each have their own use cases. Containers are great for modernizing applications and allowing applications to be broken into microservices.
Virtual machines are better for large monolithic apps that need full virtual machine environments with many prerequisites and other requirements. With a virtual machine, you can choose other operating systems you want to run, such as Windows Server. Containers are limited to Linux only, since they share the kernel of the Proxmox host.
Docker is the Most Popular
While LXC containers have been around longer than Docker containers, Docker is certainly more popular with developers as it is more focused on running application containers. The LXC container technology is more focused on system administrators or system containers.
Both LXC and Docker containers share the same kernel as the host operating system and are quick to provision. With Docker containers, you get a large ecosystem of containerized technologies built around Docker, and you can do things like easily work with storage with bind mounts with various storage technologies. With a bind mount, you can mount a local volume from your Docker host into your Docker containers.
Docker containers can be described in configuration files called Docker files. You can also use Docker in not only Linux distributions but Windows environments as well.
You can easily spin up a new Docker container using the following command:
docker run <container name>
Proxmox LXC Containers
The Proxmox LXC containers can be spun up using the Proxmox graphical web user interface after logging into the Proxmox web interface and are tightly integrated in the Proxmox solution. They are a lightweight alternative to virtual machines.
The ability to manage containers is built into the Proxmox interface and makes using containers and virtual machines in the same interface possible.
LXC containers are more like virtual machines
LXC containers are much more akin to virtual machines than Docker containers. They can serve in the place of full virtual machines for certain use cases, including a Docker container host.
Note. Check our article on how to update Pi-hole.
Creating new Proxmox containers
You can right-click your Proxmox host and choose the option Create CT. This option will launch the wizard to create a new container.
In the wizard, you will create a new container with the same choices as with the virtual machine:
- CPU
- Memory
- Disk space
- Network configuration
- Linux distributions for container template
Choose Container Hostname
On the General configuration, you set the container hostname and other options like unprivileged container to ensure unprivileged user requests, nesting, etc in Linux containers.
Choosing Your Container Template
You choose the container template you want to use on the template screen.
Proxmox calls their LXC integration the “Proxmox Container Toolkit” (pct), as it simplifies the use of LXC containers and provides a nice GUI around LXC container configuration.
Choosing Storage
Choose the storage size and location for the container. This is different than a bind mount point. Here you are setting the actual disk size of the container.
Configuring the CPU Settings
Choose the CPU cores settings in the container wizard.
Configure Memory for Your New Container
Configure the memory for the LXC container configuration, including memory usage and swap configuration.
Configure the Network Configuration for LXC Container
On the network configuration page, select the bridge to use, VLANs if needed, and set your IP address configuration.
Also configure your DNS settings for the new container.
Confirming the Creation of the New LXC Container
Finally, confirm the configuration of the new LXC container.
Container Template
With the container template, you can choose which templates you want to download and have available locally. You will need to download a template before you get started with the new container wizard as this is an option that needs to be configured.
Note. Read our article about Proxmox alternatives.
Download Container Images
When you navigate to storage resources configured to house templates in Proxmox containers, you will see the container templates available for download.
Nesting Docker Containers Inside LXC Containers
Even though Proxmox doesn’t have a built-in way to spin up Docker containers as it does for LXC containers, one way you can easily spin up Docker containers is by nesting your Docker container environment in an LXC container.
Create a new Proxmox LXC container which uses the built-in process to create Proxmox containers. There are many options on the General tab, including unprivileged containers, nesting, SSH keys, password, etc.
The templates tab allows choosing the Linux container image you want to use for the Docker host LXC container. Here, we are choosing Ubuntu 22.04.
After provisioning a new LXC container as a Docker host, you can install Docker per the official documentation for installing Docker in Linux. The LXC container automatically configures the root user as the default login and is the password you set during the provisioning of the LXC container.
To install Docker inside your LXC container, you can run the following commands:
sudo apt-get update sudo apt-get install \ ca-certificates \ curl \ gnupg \ lsb-release -y && \ sudo mkdir -m 0755 -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \ echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null && \ sudo apt-get update && \ sudo chmod a+r /etc/apt/keyrings/docker.gpg sudo apt-get update && \ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
How to Install Docker in Proxmox Using a Virtual Machine?
The process to install Docker inside a virtual machine running on Proxmox is the same as the process above for installing Docker. The only difference in the process is you are configuring new fully virtualized machines with a host operating system to house the Docker installation.
You first choose your virtual machine Linux distribution you want to use as a Docker host, then you install Docker. You can use the same commands listed above to install Docker inside your Proxmox virtual machine used as a Docker container host.
Wrapping Up
Proxmox is a powerful container platform offering many options for admins to run both LXC containers and Docker containers. Containers provide a great way to run modern applications without the resource requirements, footprint, and other challenges with full virtual machines. Proxmox offers native LXC container support and allows running Docker containers nested in LXC containers or running in full virtual machines configured as Docker container hosts.