Saturday, June 20, 2015

How the application server works in unRAID - What is Docker?

I'm going to take you back to one of my first posts where I explained what the purpose of a hypervisor is and what the differences between a level 1 and a level 2 hypervisor are. I think this would be useful to understand before proceeding with this post. 

Basically the idea behind a hypervisor is that it has the ability to emulate hardware in such a way that an operating system running on the hypervisor has no idea that it is not a physical machine. By creating multiple VMs you have the ability to isolate applications from each other, for example you might have one VM for torrents and automated media management, and then another for development work. This is all great in theory but the issue with this is that virtualisation is resource intensive! The alternative to deploying Virtual Machines is using 'containers'. Containers are similar to virtual machines in that they also allow for a level of isolation between applications but there are some significant differences..


What's a container? How does it differ from a Virtual Machine?

Going back to the idea of a virtual machine - it helped us to get past the idea of a one server for one application paradigm that was formerly common in data centers and enterprise. By introducing the hypervisor layer it allowed for multiple different OS to run on the same hardware so that many different applications could be used without wasting resources. While this was a huge improvement it is still limited because each application you want to run will require a guest operating system, it's own CPU, dedicated memory and virtualised hardware. This lead to the idea of containers..

unRAID makes use of Docker containers. Similar to the idea of a virtual machine Docker containers bundle up a complete filesystem with all of the required dependencies for an application to run. This will guarantee that it will run the same way on every computer that it is installed on. If you have ever done any development work you may understand the frustration of developing an application on one machine, and then deploying it on another machine only to find out that it won't launch. Docker helps to do away with this by bundling all the required libraries etc. into one lightweight package with the 'Docker Engine' being the one and only requirement. The Docker Engine is is a program that allows for containers to be built and run.

Fundamentally a container looks similar to a virtual machine. A container uses the kernel of the host operating system to run multiple guest instances of applications. Each instance is called a container and will have it's own root file system, processes, network stack, etc. However the fundamental difference being that it does not require a full guest OS. Docker can control the resources (e.g. CPU, memory, disk, and network) that Containers are allocated and isolate them from conflicting with other applications on the same system. This provides all the benefits of traditional virtual machines, but with none of the overhead associated with emulating hardware.

The Docker Hub

One of biggest advantages Docker provides is in its application repository: The Docker Hub. This is a huge repository of 'Dockerised' applications that I can download and run on my microserver. With unRAID and Docker it doesn't matter if it's a windows or linux application, I can run it in a docker container. Really cool stuff.

No comments:

Post a Comment