devops docker linux

Docker, we have been reading this name more and more in the last years, but let’s be honest, at the beginning the aura around it may be confusing and misleading.

Assume that you are curious and decide to google for it and before finding out this awesome page, you decide to enter the Wikipedia page and start reading (link)

Docker is a set of coupled software-as-a-service and platform-as-a-service products that use operating-system-level virtualization to develop and deliver software in packages called containers.

In the following image you can see your reaction while reading the definition.

docker devops os wtf

Ok then but what does that mean?

Basically, you need to shift your mindset.
Until now, whatever your job/occupation/studies was, you always thought that you should have a PC/server, where you install an operating system, some basic libraries and applications, then you start installing stuff.

Think about what you do to try an application or a service, more or less you’ll follow this process:

  • Check hardware requirements (HW)
  • Check operating system requirements (SW)
  • Check if there are dependencies from other software/services
  • Get the package
  • Install the package
  • Cry because the application doesn’t start and complies about the version 1.103945-295r^2 of libwhatever-devel

So you end up with less space on disk, an unusable installation and probably you also updated some packages needed by the installation from test repos and your system is now unstable.

So what is docker?

What if you didn’t download the standalone package of your application or service but you downloaded the application and everything that is needed by it to start and work properly?
This is exactly what docker allows you to do.
Docker is a tool that introduces the concept of container, that is to say something that contains everything and only what you need for your purpose. It allows you to deploy a full working application or service without touching anything (or at least with very few tuning).

A container is usually based on an “image” that usually ships:

  • A base system distribution (centos/debian/ubuntu)
  • All and only the libraries/dependencies that your application needs to run
  • Parameters, like port mapping, directory mapping and so on, that allow you to customize the way your application has to run

Once you initialize that image by downloading it from a registry or building one on your own, you can “run” it into a container, an entity that lives a life on its own, without affecting system files, misconfiguring your existing applications or being there even when you decide you don’t need it anymore.

As I already said there is a little bit of tuning that you could do, but only if you need customization, for instance you want to run a webserver on port 5001 instead of port 80, or you want to map a particular directory on your filesystem in order to be used by the container as if it is its own directory.

By the way, this is just a brief introduction to what docker is, if you are interested in going deeper about it, just follow my tutorials in the dedicated section to unleash the power of this tool.

Meanwhile, here are some resources from theĀ official docker website that you can use to start getting familiar with docker:

Docker documentation

Hope you enjoyed the article, feel free to comment it!