Share this post with your friends
In this post, I will talk about what is LXC, the differences between LXC Containerization and Virtualization, and why I like LXC more than Docker.
Introduction to LXC
LXC is a Linux Containerization system like Docker. It uses the new Linux kernel namespace feature to isolate containerized operating systems from each other.
Learn more at linuxcontainers.org
LXC vs Virtualization
In a virtual environment, the virtualization software simulates the hardware. So you can run different operating systems such as Windows, Linux, Mac OS and many others. These operating systems can have their own version of kernel. They need not to be the same as the host operating system.
But LXC uses the same kernel as the host operating system. The kernel cant be different. LXC uses the latest Linux kernel namespace feature and chroot to make an isolated environment for the guest operating system. So it can't make any changes to the host. It works just like virtualized environments. You can assign different IP addresses to the containers and do anything you like.
In a virtualized environment, the RAM you set for each virtual machine is allocated when you run the virtual machine. But LXC don't do that. LXC keeps your system memory free and allocates memory as required. The advantage is that you can run more LXC containers than virtual machines with same amount of RAM.
The speed of LXC containers are also much greater than virtual machines. Because a complete hardware simulation is slower.
When to use LXC?
Use LXC when you know all you will ever need is Linux virtual machines. LXC supports Alpine, Debian, Ubuntu, Fedora, CentOS, openSUSE and many more linux distributions as of this writing.
When to use Virtualization?
When you want to virtualize Linux, Mac, Windows and other different types of operating systems, virtualization is better for you. Also, if you need to work with different versions of Linux kernel, virtualization is the best way to go.
Why I like LXC
The reason I like LXC is because while creating a container with 'lxc-create', I can provide a mirror to my own local Linux repository. So it saves a lot of time and bandwidth for me. The administration is also simpler than anything I've ever used. I can use existing Linux technologies like LVM with LXC. These are basically the main reasons.