lightweight virtualization – docker

Virtual machines can allow you better utilize the resources or make it possible to run multiple incompatible versions of the same software or even different operating systems. Virtual machines sound like the perfect solution, instead of a server that runs only database server or web server you can have a single server that runs both of them and more.

There is actually one little downside to all of these virtual machines.  Each one is actually running an entire operating system.  This takes up more ram and more disk space than is strictly necessary.  A single windows 7 installation could take 10gb disk space but four could take 40gb or more.

It doesn’t take a mathematics genius to see this downside to just using virtual machines fairly clearly – the solution was to bring down virtualization to the application level.

Containers

This “application virtualization” was created as containers.  These containers contain not only the application but it also bundles other required resources.  These containers then are separated from each other in the operating system through the implementation of both namespaces and cgroup‘s inside the Linux kernel.

The difference between container technology and virtual machines is that the containers use the host operating system for the application while the virtual machine has its own operating system.  Thus the resources used by a container should always be less than any virtual machine.

Docker

Linux did create its own container technology (LXC/LXD) but for most people a more recognizable container solution is Docker. Docker is a friendly command line container program which is more performent than using a VM but more importantly it also has a repository of containers that have been already been built. It is quite possible that the program that you want or need is already in a docker container.  There are two different sets of precreated containers, official docker containers and community containers.

Docker may have been originally developed on Linux but this awesome container technology can be run on either Linux or Windows – well, Windows 10 and Windows server 2016.

Docker is basically just a command line program and because of that you can use all of the same commands on Windows as you do on Linux.  Actually, if you really are a Windows aficionado you will be happy to learn that you can also use powershell command line as well with Docker.

The installation process is really strait forward, rather than duplicate the instructions here are a few links for installing docker on Linux.

How to install Docker and run Docker containers on Linux Mint 18/18.1

How to install Docker Machine on Linux Mint 18 and 18.1

I plan on doing a few more blog posts on actually using Docker, but for right now I will put up a link for a history of Linux containers.  The solution of a program utilizing the host operating system but yet being (somewhat) segregated from all the other processes is not new.  The solution for segregating a an application used to be a chroot.

History

https://dzone.com/articles/evolution-of-linux-containers-future

This entry was posted in programming and tagged , . Bookmark the permalink.