4 fundamental reasons why you should learn Linux Containers along with Docker and why they’re as cool as Docker Containers. Of course they serve different purpose, but are complimentary.
Whether you are a developer, infrastructure, operations or a cloud professional, you ought to learn about Linux Containers! More so, if you are a college student learning computers and like to dive deep into system architecture, you should have learnt this yesterday. Linux Container is the next generation of OS virtualization techniques and helps get rid of your long time Virtual Machine woes. Lets see why these “System Containers” are so cool. Why do we even call Linux Containers as System Containers? Simply, because they are full-fledged Linux Operating Systems by themselves. And guess what, multiple such Linux System Containers can co-exist on the same physical host/computer in a completely isolated, independent and efficient manner. Therefore,
What Docker Containers are to Applications, LXD is to Linux Machines!
Linux Containers are Super Efficient
If you have ever tried creating 2 or more Linux based virtual machines on your local computer (whether desktop or laptop) using any hypervisor, you would know that it’s a nightmare in terms of system performance. Each Linux VM can be anywhere from 600 MB to 1 GB+ in terms of disk usage, needs a separate OS, static RAM allocation and much more. Even if the VM Operating System is exactly the same as your physical host OS, the VM will need a duplicate copy of the same operating system.
This OS duplication is at the heart of VM and System Container comparison. Linux system containers address this issue and do not need a duplicate OS copy to run. This is irrespective of what Linux OS you are using on host and your Linux Containers. Of course, this is only true for all Linux OS’ with the same kernel.
To illustrate the above-mentioned scenario, imagine that you have an experiment to perform or a project to implement which needs the following simple config;1.) 5 Independent Linux Machines – 1 CentOS, 2 Ubuntu, 1 Mint and 1 Fedora distros
2.) Two HTTP Servers, Database Server, Cache Management and Load Balancer
Such a multi-Linux-machine scenario can be easily implemented by creating and using 5 independent Linux System Containers on a single physical host with a single Linux OS. To replicate this same set up using 5 Linux VMs, you’d need 5 different copies of Linux OS and much more.
Linux Containers are Disposable (Infrastructure)
You can literally create, use and dispose of these system containers (LXD Containers) as and when you need without disturbing your original Linux host.
Imagine a situation where you had a tricky project to execute and it required a whole bunch of experimental scenarios for you to work on. This could be a new server set up or a single node installation of OpenStack. Any infrastructure professional would agree to the fact that, if you perform such infra related experimentation on your localhost (your physical computer with the base OS), there would be a multitude of changes made to your base system. This is because complex projects like Single Node OpenStack Installation or a comprehensive server set up requires to manipulate system libraries, services, file permissions, and directory structures to mention a few things.
It’s a safe bet to say that unless you run a well-defined installation script from the likes of DevStack/PackStack in case of OpenStack or similarly comprehensive and well-tested scripts for server setups from GitHub etc, Things Will Fail many a time before you reach a stable state of your desired project outcome. Given all of this, you really do not want to mess up your local system by running all such experimental scenarios over and over again.
For such experimentation, just use Linux System Containers, create your desired systems/machines, use them and simply dispose them at the end. This way, you’ve experimented enough, completed your desired infra project, cleaned up everything that you created without even touching your base system config. Of course, it’s not necessary to dispose of all your hard work. You can always save your Linux System Container images, much like you save your Docker container images and export them, save them to a central repo and let the larger world benefit from your hard work.
An example of a publicly available/shared Linux System Container.
Multiple Linux OS on a Single Linux Host
Linux Containers are managed using LXC/LXD and its super awesome. To give you a realistic idea, you can run almost all of the widely used Linux distros like Ubuntu, Fedora, Oracle Linux, OpenSuse, Debian, CentOS, Gentoo etc. using pre-defined LXD images and even customize them further to your needs.
Guess what, you do not need to create multiple VM’s with multiple OS copies to achieve this. Just pull the relevant container image from LXD repository, start the container and you’re good to go.
But, what is LXD anyways? LXD is a next-generation system container manager. It offers a user experience similar to virtual machines but using Linux containers instead. It’s image based with pre-made images available for a wide number of Linux distributions and is built around a very powerful, yet pretty simple, REST API.
Experimentation for Innovation
This aspect is particularly important for curious souls, especially college students wanting to build their projects based on a plethora of use cases. In the age of cloud computing, Internet and Containerization, there is really no reason for someone to stop experimenting.
It’s literally the age of disposable infrastructure!
Cloud Computing allows you to create, use and dispose of almost any infrastructure component that you can imagine today. From a ready to use Machine Learning/ Artificial Intelligence toolkit to Tableau Engines, from the Internet of Things frameworks to Python Jupyter Notebooks, from container clusters to database engines; It’s all out there waiting for you to be used for your next awesome use case/project scenario.
But what do you do if you were to experiment with a few machines and apps, using a single Linux laptop/desktop WITHOUT an Internet connection? Assuming that you have all the prerequisites installed along with LXC/LXD, you can use Linux System Containers to work with your use case and experiment.
I am sure by now you realize what Linux System Containers allow you to do in terms of machine isolation, independence, efficiency, replication, sharing, and disposability. Sounds similar to what Docker containers do? Yes, in the context of systems.
So, are you ready to create your first Linux System Container?