You may have heard of docker and wondered what on earth it is all is all about? Are other devs around you all talking about virtualization and you feel like you might be missing out? Then stick around, you have come to the right place (well post).
Before we start talking about all the exciting and useful features of docker, lets first look at the problems are it aims to solve. So lets say you have come up with the awesome Python application, it uses some custom imports and a specific version of Python. Now you are ready to upload it and share it with the world, exciting times! 🥳
You tell all your friends about this super application and they all start downloading but no one seem to be able to get it working. You work out that one of your friends doesn’t have Python installed, another can’t find where to download the custom packages, another is running on a different OS. Your dreams of success are now dashed, but wait docker to the rescue. 🦸♂️
So what does docker do?
In the simplest terms docker lets you package up your whole application, along with an operating system and pre-requisites. So when you give it to someone else, as long as they have docker on their PC (or server) then it will run exactly the same. This means you don’t need to waste time worrying about compatibility or environment differences. Sound too good to be true, then read on.
So how does it all work?
Warning, we are now getting into the nerd zone, if you just want to use docker and am happy ignoring the nuts and bolts then feel free to skip ahead, otherwise grab a coffee ☕ and lock yourself in.
The easiest way to think of docker is to split it down into building blocks. At the lowest level you have the physical infrastructure running in your data centre or public cloud provider. We are talking about servers, or even your own PC.
The next level up is the host operating system. Note this is only the host operating system and it does not need to be the same as you want to use for your application. For example you can run Linux applications on a server running Windows.
Next up is the hypervisor/docker engine, this is where virtualization starts. The docker engine is what controls all of the applications you want to run, scaling, load balancing. You can think of it as the brains.
Next is your application which consists of 3 main parts:
- Guest OS – This is the operating system you want to run your application on.
- Binaries or libraries – This is where you have bundled all those Python libs you found.
- Application code – This is your actual application code itself which you have created.
Believe it or not, the above is still at a high level but this is an introduction so we will stop at this point. Hopefully you have been able to stay with me this far. If not just pop a comment over and I will see if I can help.
So how do I get this?
So whether you ready the previous section or not you may want to go take a look at this docker thing. Well the good news is that it is actually pretty simple to get it installed and running. I would advise against watching some of the docker tutorials online as they go into a lot of detail and may initially scare you off (as they did me).
So as long as you are using docker for non-commercial reasons the good news is then it is free. If you then progress on to wanting to use it in your company then you can take a look at the licensing but it is pretty cheap.
As a started I would recommend looking at docker desktop which is a product from docker themselves. You can sign up to docker personal here and download your version of docker desktop.
Now you have docker desktop up and running then you could take a look at Visual Studio Code dev containers, check out our post for more details.