The Proxmox VE hypervisor server allows 2 ways to virtualize, the first is to make virtual machines, and the second is to make Linux containers (LxC) . In this guide we will see the second variant: how to create an LxC container in Proxmox VE step by step and what to do in each of the tabs of the container creation wizard.
A container should be used when we are going to deploy a Linux distribution for which we have an LxC template (Template). LxC container technology is based on the security mechanisms available in the Linux kernel. This allows virtualization of a system using the kernel of the virtualization server itself, and achieving greater performance than virtual machines, since there is no need to emulate hardware and also run an entire guest operating system, as is the case with Virtual machines. LxC containers also save us the entire system installation process and their deployment is simple and fast as we will see in this tutorial. Furthermore, its mode of operation is more efficient, because if they are not using the assigned resources, the hypervisor (Proxmox VE Server) can use them in other containers or virtual machines.
LxC containers in Proxmox VE are created from templates, which can be downloaded from the internet using the same Proxmox VE server.
Manage LxC templates (Templates) for Proxmox-VE
In order to manage the LxC templates in Proxmox VE we go to the storage that is configured to store them, by default it is “Local”. For that, we select the “Local” storage as shown in step 1 of the following image. Next, we select the“ CT Templates” option as indicated in step 2, and we have several options available: “Load”, “Download from URL”, “Templates”, “Delete”.
The “Upload” option allows us to upload a template from our computer to the Proxmox VE server.
“Download from URL” allows us to specify a URL from where the template will be downloaded to the server.
“Templates”, this option, shows us a window with the list of official templates provided by the Proxmox VE developers. In this case, we select this option as shown in step 3 of the following image.
A view should be displayed with the list of official templates provided like the one shown in the following image, in which we will select the desired one (1) and click on the download option (2).
Next, a window will appear indicating the download progress of the image and its validation. In this new window we must wait until it notifies us that the process is completed (TASK OK). This may take time depending on the internet connection that the server has. Then we can close this window.
Next, we can see in the list of templates that the template we downloaded has been added.
We can download all the templates we want, always keeping in mind that this will take up the space corresponding to each template.
Create an LxC Container in Proxmox VE
To create an LxC container in Proxmox VE we are going to follow the following steps starting from the fact that we already have a Proxmox VE server installed and running. We have already accessed the administration website through a web browser using the URL https://proxmoxservidor ip:8006 , downloaded some LxC template in one of the storage and once authenticated in the access form, we must have a view like the one shown below, in which we will select the “Create CT” button.
Once the button to create a container is pressed, a wizard will appear that will guide us through the process of creating a container, as shown in the following image.
Step 1 is to specify the ID that the container will have, which is an integer greater than 100. It must be taken into account that no other container or virtual machine with that ID already exists.
As step 2 we will write the host name, the 3rd and 4th steps will consist of specifying the password for the root user of the container. We will also check the selection box to show advanced options in the next tabs and finally we will click next.
In the next tab we will select the base template to use in the container. Here we will select the storage where the templates are (1) and then we will choose the template to use (2), and finally we click on next (3)
In the “Disks” tab we will select the storage where the container disk (1) will be saved, we will specify the amount of gigabytes of available space that the container will have (2). As an additional option to increase performance a little, in the mount point options, we can choose “noatime” (3). To continue, click next (4)
In the CPU tab, we will specify the number of cores that our container will be able to use (1). In this case we selected 4, but they could have been less or more depending on what our Proxmox VE server has available. To continue, click next (2).
The next tab, “Memory”, allows us to specify up to what maximum amount of RAM the container can use (1). Unlike virtual machines, if the container is not using all that amount of RAM, it can be used by other containers or virtual machines. We will also specify how many megabytes of space will be used as swap memory by the container. Remember that the containers are based on Linux (2), we click next to continue (3).
In the “Network” tab, we will select which network bridge our container will connect to (1), which IP address it will have in IP/CIDR notation (2). We will also specify which gateway our container will use to communicate outside the local network using IPv4(3).
Optionally, we can specify a maximum traffic limit for the network interface being configured (4), then click next (5).
Next, we move on to configure the DNS options. In this tab, we will specify the domain name that the container will use (1). Remember that the host name was specified in the first tab (General). We will also establish the IP address of the DNS server that the container will use (2). Next, we click next to continue (3).
Upon reaching this “Confirm” tab, we are shown a summary of all the options chosen for us to verify. If necessary, we can move to any of the tabs above and change the options again.
We also have an option to specify that the container will be turned on once it is created, or we can leave it unchecked and do it manually whenever we want.
To finish the container creation process, we click on the “Finish” button as shown in the following image.
Next, an image like the one shown below will appear with a summary of the completion of the tasks. Once finished, we click on the close icon in the upper right corner.
Back to the main interface of Proxmox VE, you must select the newly created container (1) and we will see the vertical menu marked with box 2 available and in its first summary option the view shown in box 3 will be activated.
In the panel marked with the number 2 in the previous image we have available in the form of a vertical menu several options for configurations and operations on the selected container, which are:
- Summary (Overview with information on the consumption of allocated resources)
- Console (Output to screen, this is what you would see on the monitor on a real machine)
- Resources (List of assigned resources and provides options to manage them)
- Network (Manages network interfaces and their options)
- DNS (Manages the host name, domain and DNS servers to use)
- Options (General container options, include auto power on, etc.)
- Task history (Record of operations performed on the container)
- Backup (options to manage full backups)
- Replication (Options to manage container replication)
- Snapshots (Management of incremental copies over time or returning to a previously marked state)
- Firewall (Options to configure the Proxmox VE firewall for this container specifically)
- Permissions (Manage container permissions)
The next step is to turn on the container by clicking on the option marked 2 in the image, or by secondary clicking on the container icon and choosing the “Start” option.
After that, the next step is to access the container console (3). The container screen should be displayed as shown in the following image marked with option 4.
At this point, we have already created our LxC container, and we save ourselves the operating system installation process. From now on, the behavior of our container will be practically the same as a real computer.
So we can now use our container both directly and over the network, as if it were a real computer connected to our network and being indistinguishable (whether it is a physical or virtual computer) from the other computers on the network.
After following this guide you should be able to know the minimum steps to create an LxC container in Proxmox VE 7.4