What is Docker ?

In this article, we will go through an overview of docker. First, let’s understand what containers are. The most popular container technology out there is docker. So let’s find out why you need docker and what it can do using a simple example. Suppose you need to set up a project with different technologies such as web server using node.js, database using MongoDB, etc. Then you may come across,

Issue of compatibility: The first issue is the compatibility of these services with the underlying operating system. Sometimes certain versions of the services may not be compatible with the OS. Another issue is that the compatibility of these services and libraries with each other. Some services need one version of a dependent library whereas another requires another version of the dependency. Every time we change something, we will need to check the compatibility of these services with others(known as “matrix from hell”).

Long set up time: Every time we want to set up the project in a new environment, we have to follow a large set of instructions and commands while checking whether we are using the right OS with right versions of the components.

Different dev/prod/test environments: Developers may be comfortable in using different OS and we can’t guarantee that the application that we are building would run on the same way in different environments. So it makes developing, building and shipping the applications difficult.

But with docker, we can run each component in a separate container with its libraries and dependencies. We can build the docker configuration once and everyone can now get started with a simple docker run command without considering of what the underlying operating system they run. The only thing that we require is to make sure that docker is installed in the systems.

If we look at containers, they are completely isolated environments just like virtual machines except they all share the same operating system’s kernel. Setting up these container environments is hard as they are very low-level and that is where docker offers a high-level tool with several powerful functions making it easy.

To understand how docker works let us understand some basic concepts of an operating system. First, if you look at operating systems like Ubuntu, Fedora or CentOS, they all consist of an OS kernel and a set of software. The operating system kernel is responsible for interacting with the underlying hardware while the OS kernel remains the same which is Linux. It’s the software above it that makes these operating systems differ. So you have a common Linux kernel shared across all operating systems and some custom
software that differentiates operating systems from each other.

Let’s say we have a system with an Ubuntu OS with docker installed on it. Docker can run any flavour of OS on top of it as long as they are all based on the same kernel in this case Linux. Docker uses the underlying kernel of docker host which works with all the operating systems above. But you won’t be able to run a windows-based container on a docker host with Linux OS. For that, you would require a docker on a Windows server. Since docker is not meant to virtualize and run different operating systems and kernels on the same hardware the main purpose of docker is to containerize applications.

Due to these characteristics, Docker containers are lightweight and are usually in megabytes in size and allows Docker containers to put up faster. So most of the organizations have their products containerized and available in a public docker registry called docker hub. Once you install docker on your host, you will be able to simply create containers of different images. Docker images are more like a recipe where you can create many instances (containers) of that image.

Containers are running instances of images that are isolated and have their environments and set of processes. You also can create an image yourself and push it to the docker hub repository making it available for the public. You can find more details from the references or the docker web site.

References

  1. https://www.docker.com/
  2. https://www.youtube.com/watch?v=rmf04ylI2K0
  3. http://www.floydhilton.com/docker/2017/03/31/Docker-ContainerHost-vs-ContainerOS-Linux-Windows.html

--

--

--

Former Software Engineering Intern @ WSO2 | MIT Undergraduate @ University of Kelaniya, Sri Lanka.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Install Golang & Setting up its path ( and Env Variable)

A Practical Way To Use Bitbucket Pipelines

First Steps in Java — Part 3

Understanding Control Flows in Python

Crafting a Useful & Extensible Toolchain

EKS Anywhere., decoding the architecture.

Creating the Original Pong Using Ruby

Mr.Tompkins in Enterprise IT

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Prabod Dunuwila

Prabod Dunuwila

Former Software Engineering Intern @ WSO2 | MIT Undergraduate @ University of Kelaniya, Sri Lanka.

More from Medium

Docker deep level with architecture — part 1

GitLab CI CD Pipeline Tutorial

Self Hosted Docker Agents in Azure

Container Image Concept to Create a Container on Microsoft Azure