Back to Blog

Proxmox Virtualization Series: Creating an LXC Container in Proxmox host – Part 5

To create an LXC container in Proxmox, download a container template with “pveam”, then walk through the “Create CT wizard” to set the hostname, template, disk, CPU, memory, network, and...
Choose your BDRShield Management Console - Cloud or On-Premise:
Hybrid Storage (Local & Cloud)30-Day Free TrialFull-Feature Access
Not sure which console fits your needs? Request Demo ?
By Gopal | March 25, 2024

TL;DR

To create an LXC container in Proxmox, download a container template with “pveam”, then walk through the “Create CT wizard” to set the hostname, template, disk, CPU, memory, network, and DNS settings before finishing.

  • LXC containers share the host kernel, giving them lower overhead than full VMs, while Docker packages a single application with its dependencies
  • Templates are downloaded from Proxmox’s built-in library using pveam update, pveam available, and pveam download, or through the web GUI
  • The Create CT wizard covers seven tabs in order: General, Template, Disks, CPU, Memory, Network, and DNS, followed by a Confirm step
  • LXC containers trade some advanced isolation features for lighter weight and faster deployment

Introduction

What is Proxmox LXC container

Proxmox LXC containers are a popular method for virtualization and containerization. LXC stands for Linux Containers, which is a lightweight and efficient virtualization technology. Proxmox, on the other hand, is an open-source platform that provides virtualization management capabilities. With Proxmox LXC containers, users can create multiple isolated environments on a single physical server, allowing for the efficient utilization of resources.

These containers operate at the operating system level, sharing the kernel with the host system, which results in improved performance and reduced overhead. Proxmox LXC containers provide an ideal solution for various use cases, such as application deployment, development environments, and even web hosting. They offer flexibility, scalability, and ease of management, making them suitable for both small businesses and large enterprises.

By leveraging Proxmox LXC containers, users can achieve better resource utilization, enhanced security, and simplified management of their virtual infrastructure.

How Proxmox LXC containers differ from traditional Dockers

Proxmox LXC containers and Dockers are both popular solutions used in the world of containerization. While they share some similarities, there are key differences that set them apart. Proxmox LXC containers, short for Linux Containers, provide an operating system-level virtualization method. They offer a lightweight and efficient environment for running applications, allowing for better resource utilization and lower overhead.

In contrast, Dockers utilize containerization technology to package and run applications with their dependencies in isolated environments. This makes them highly portable and enables easy deployment across different systems. Additionally, Dockers provide a streamlined workflow through the use of container images and version control. When choosing between Proxmox LXC containers and Dockers, it is essential to consider the specific requirements of your project and the level of virtualization needed. Overall, Proxmox LXC containers are an excellent option for those seeking a lightweight and efficient virtualization solution, while Dockers excel in delivering portable and scalable application deployments.

In this blog, we are detailing the steps that involves to create a LXC container in a proxmox server. Proxmox allows you to create a LXC container from container images, referred as templates. Proxmox stores a wide range of LXC container images or templates, we can download the container image into the proxmox server and using the image, we can create many number of LXC containers in quick time.

Attribute Proxmox LXC Container Docker
Virtualization level Operating-system-level, shares host kernel Application-level, packages app with dependencies
Overhead Lightweight, lower overhead Lightweight, focused on single application
Portability Runs a fairly complete Linux environment Highly portable across systems via container images
Workflow GUI or pveam template-based setup Streamlined workflow via container images and version control
Best suited for General-purpose isolated environments, app deployment, dev environments, web hosting Packaging and deploying a specific application and its dependencies

Container images or Container templates

Container images, often called “templates” or “appliances,” are comprehensive packages stored as tar archives. These self-contained packages include all the necessary components to run a container effectively. When using Proxmox VE, users gain access to an extensive collection of basic templates for the most prevalent Linux distributions. These templates can be conveniently downloaded using either the graphical user interface (GUI) or the pveam (Proxmox VE Appliance Manager) command-line utility.

By offering a wide range of templates, Proxmox VE ensures that users can quickly and efficiently set up containers without the burden of manual configuration.

Choosing your container template

Before creating a LXC container, user must understand his requirement and the linux flavour he wants to use for the container. Users can get the list of container templates by executing the below command in the proxmox host server shell. Before that he should update the list.

# pveam update – Execute to update the container list
# pveam available – Shows the avaiable list after update
Below screenshot shows these two steps.

LXC Container in Proxmox host

Here we are going to download the template “ubuntu-20.04-standard_20.04-1_amd64.tar.gz.”, since we are going to use ubuntu 20.04 version as the Linux distro for the container. Before you can use such a template, you need to download them into one of your storage targets. If you’re unsure to which one, you can simply use the local named storage for that purpose. For clustered installations, it is preferred to use a shared storage so that all nodes can access those images.

Here is the command to download the ubuntu 20.04 container template.

# pveam download local ubuntu-20.10-standard_20.10-1_amd64.tar.gz

You can also download from webgui console. The below screenshots shows this.

Click Templates on the selected storage page, and choose the download button after selecting the Container template.

LXC Container in Proxmox host

Click Download. The respective tgz file will be downloaded and saved under CT templates as shown below.

LXC Container in Proxmox host

Creating a LXC container using the downloaded CT Template

Login to proxmox host server web console using root user and its credential
Choose Create CT, a new dialog page opens

General:

Under General tab,
Node : choose the proxmox host
Hostname : Provide a host name
Resource pool : Choose the resource pool you created
Password : Provide a password for the root user
SSH public Key : Upload the public key, if you want to access the container through SSH from network.

LXC Container in Proxmox host

Click Next to Template Tab,
Template :
Under Template, Choose the storage where you downloaded the CT template, and select the respective template you downloaded. Below screenshot shows this step

LXC Container in Proxmox host

Click Next to Disks Tab,

Disks :
Under Disks Tab,

Storage: Choose the storage location where you want to store the container created files. In our case, we already creaged a storage called “vmrepository” to store VM and Container files. so choosen that stroage.

Disk Size (GiB): Allocate the disk size of the container. Default is 8GB, user can increase or decrease the disk size as per the requirement.

ACLs: Default ACLs allows the user to set more detailed file ownership than the traditional user/group/others model.

Mount options: Default none. ( lazytime, noatime & nosuid are configurable )

Skip replication: By default, additional mount points are replicated when the Root Disk is replicated. If you want the Proxmox VE storage replication mechanism to skip a mount point, you can set the Skip replication option for that mount point.

LXC Container in Proxmox host

Click Next ti CPU tab,
CPU:
In CPU tab,
Cores – Number of CPU cores required for the Container.

CPU Limit – The count limits the CPU usage. If we assigned 4 cores, then limit the CPU to use it below 4 or not. Default is unlimited, meaning no limit.

LXC Container in Proxmox host

Click Next to Memory tab
Memory:
In Memory tab,
Memory (MiB): The total memory allocated to the container.
Swap (MiB): Allows the container to use additional swap memory from the host swap space.

LXC Container in Proxmox host

Click Next to Network Tab,

Network :
In Network tab,
Name: eth0. Name of the NIC interface
Mac address: Auto. Automatic MAC address is assigned.
Bridge: vmbr0. Bridged to the host bridge vmbr0
VLAN Tag: No VLAN. If require you can speicify the tag no.
Firewall: Enable. Allows you to configure firewall rules. A default policy in place for the container
IPV4: Static or DHCP. If static, provide a static IP with CIDR notation. If you have DHCP server, choose DHCP, same settings for IPV6 too.
Gateway – Provide the Gateway IP

LXC Container in Proxmox host

Click Next to DNS tab,
DNS:
In DNS tab,
DNS Domain: provide your domain name as per your network environment
DNS Server: provide your local DNS server IP

LXC Container in Proxmox host

Click Next to Confirm

In the confirm tab, verify your settings provided, and enable “Start after created” to start the container immediately after it created.

LXC Container in Proxmox host

Click Finish to start the Container creation process. You can view the creation process and within few seconds your container will be ready and running.

LXC Container in Proxmox host

Once the container is up and running, you can access the container through console in the proxmox web GUI by entering the root user and password.

LXC Container in Proxmox host

Conclusion

In conclusion, the process of creating a LXC container in Proxmox host offers numerous advantages and a few drawbacks worth considering. LXC containers provide a lightweight and efficient alternative to traditional virtualization methods, allowing for better resource utilization and faster deployment times. With Proxmox host, the management and administration of LXC containers become more streamlined, enabling users to easily configure and monitor their containers.

However, it’s important to note that LXC containers may lack some advanced isolation features found in other virtualization technologies. Despite this limitation, the flexibility, scalability, and cost-effectiveness of LXC containers in Proxmox make them a compelling choice for various use cases.

FAQ

1) What is a Proxmox LXC container?

A Proxmox LXC container is an operating-system-level virtualization method that runs isolated Linux environments on a single physical server. It shares the host kernel, which reduces overhead compared to full virtual machines, and is used for application deployment, development environments, and web hosting.

2) How does an LXC container differ from a Docker container?

LXC provides operating-system-level virtualization for running a fairly complete, lightweight Linux environment, while Docker packages and runs a single application with its dependencies in an isolated environment. Docker’s image-based workflow makes it more portable across systems, while LXC is built for general-purpose, VM-like resource efficiency.

3) What are container templates in Proxmox?

Container templates, also called appliances, are tar archive packages that contain everything needed to run a container. Proxmox VE ships with a built-in library of templates for common Linux distributions, downloadable through the GUI or the pveam command-line utility.

4) How do you view the list of available container templates in Proxmox?

Run pveam update to refresh the template list, then pveam available to display the current list of downloadable templates from the Proxmox host shell.

5) What command downloads a container template in Proxmox?

pveam download local downloads a template into the specified storage target, for example pveam download local ubuntu-20.10-standard_20.10-1_amd64.tar.gz.

6) What information does the General tab ask for when creating an LXC container?

The General tab requires the Proxmox node, a hostname, a resource pool, a root password, and optionally an SSH public key for remote access to the container.

7) What network settings are configured when creating an LXC container?

The Network tab sets the NIC name (default eth0), MAC address, bridge (default vmbr0), an optional VLAN tag, firewall enablement, static or DHCP IPv4/IPv6 addressing, and the gateway IP.

8) What are the limitations of LXC containers compared to other virtualization technologies?

LXC containers can lack some of the advanced isolation features found in full virtualization technologies. Despite this, their lower overhead, flexibility, and cost-effectiveness make them a strong option for many use cases.

Read More:
Proxmox Virtualization Series: Creating a Resource Pool & VM in Proxmox – Part 4

Follow our Twitter and Facebook feeds for new releases, updates, insightful posts and more.

Rate this post
Avatar for Gopal

Gopal

I am a Systems and Networking Engineer, managing everything that comes under IT. I have been with Vembu for over 10 years.

Chat Icon
Go to Top