source: https://www.youtube.com/watch?v=k06_SCgbCHY

On 27th October 2020, I followed Bergler ICT’s first session about Docker in a series of 2. The sessions were quite short (1 hour) and hence were more an introduction to Docker. For me, that was ideal since I only knew Docker by name before then.

Bergler ICT is a small company that offers ICT services like software development, application life cycle management, DevOps, consultancy, and managed services. Because Bergler ICT is based in Breda, the Netherlands, everything was in Dutch.

In this session, they explained what Docker is, how it works, and why it is so useful.

Why should you use Docker?

The hosts started their presentation by giving the reasons why virtualization is needed and why Docker is so useful.

  • Firstly, more and more tools get published. The rise of .NET Core and the transition from monolithic to modular applications had a big impact as well (think about consistency in the context of modular applications).
  • Then, you have also the need for faster releases and test result delivery.
  • Finally, more and more work is done in the cloud, causing a decrease in development and testing time but also causing operations to get more complicated.

Docker doesn’t solve these problems themselves but shapes them. It will also decrease the complexity and increase the delivery speed of your application without a big ball of mud.

Dockers compared with VMs

Virtual machines are machines that can be run on another machine like your laptop. Those VMs have their own apps and OS but don’t know they run virtually. To make this feasible, VMs run above a hypervisor to prevent immediate interaction with your hardware.

Two big downsides of VMs, however, are that they’re very heavy and that you need to configure every new VM you’d like to add.

Docker doesn’t have these problems.

A docker can be compared to the hypervisor that VMs use. But, instead of virtualizing a whole OS, dockers virtualize only the application domain. On such docker, you can “spin” applications. These applications are separate modules that you can also deploy separately.

Docker itself is Linux-based because it needs to run on small and fast systems. Implementing dockers specifically for Windows is very difficult. But everything that’s based on Linux can run on Windows and so can Docker.

What are those “containers”?

A container is a term from the Linux world. You can compare containers with sandboxes because both have the purpose to isolate running applications.

Each container is a stack of a few images with an application layer on top. Every image has to be spun only once – even when new ones are added – which makes containers very scalable.

Containers are built based on the configuration in a docker file. Docker files are like recipes. They explain what components (mostly images) are used and what has to be done with each of them.

source: https://www.youtube.com/watch?v=k06_SCgbCHY

When your container is completely configured, you can place its image in a registry. This registry is like an app store. The registry contains several images that can be used. Be sure to choose images from trusted repositories. Twistlock is a tool that can be used to scan such images for malware.

The container image itself is completely immutable. Its behavior can be changed at runtime, but, on every spin, the container will be started from scratch and will be built according to its docker file. This makes containers very secure because things that were added later on, like malware, will be erased after every spin. On the other hand, this immutability also means that data that’s stored in the container itself will be erased as soon as the container is down. That’s why databases should be employed outside of your container unless it’s for testing purposes.

Another attribute of containers is that they don’t know how they will be used, only what they contain. It is the orchestrator (e.g.: Kubernetes) that decides how the container will be used. The resource management is thus done by the orchestrator, who also decides how many containers get spun when booting the Docker application.

The combination of containers and orchestrators makes dockers very flexible.

So how do you use Docker then?

In this session, they showed us 2 use cases of Docker. One of which was infrastructure design and the other was application hosting.

In the first demo, they showed us how to run a database on Docker. For this, you only need Docker for Windows and SQL Server Management Studio (SSMS). The process exists of 2 simple steps:

  1. Run the docker run command in cmd.exe as shown below. Make sure you change the parameters between <>.
  2. Connect to the database with SSMS by connecting to the localhost on the port you chose in the command of the first step.
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=<DB_password>" -p <port_on_container>:1433 -d -v <local_backup_volume>:<volume_on_container> microsoft/mssql-server-linux:latest 

As you see, this is very easy to do.

Then they showed us a disadvantage and an advantage of Docker. A disadvantage is how much memory Docker needs for this. An advantage, however, is how easy you can restore a backup thanks to the volume mapping.

This scenario is very useful, especially when you use files to store your database.

Before they ended this session with a second demo, they showed us some extra useful commands:

/* show the running containers */
docker ps

/* show the available images */
docker images // make sure the mssql image is available for the docker run command!

In the second demo, they showed us how you can use Docker to run a web application that uses an API. For this, you need Docker for Windows and Visual Studio (or something similar).

To run an application on Docker, you need a docker file. For the sake of the demo, they had already made a docker file so they could just explain how such a file works.

source: https://www.youtube.com/watch?v=k06_SCgbCHY

You can find the explanation of their docker file in this video starting from 41:31 until 47:26 (note: the explanation is in Dutch without subtitles).

Introduction into Docker – Bergler ICT

Post navigation