Why Docker?

Hello everyone, From this post I am going to talk about what is docker and why we need to use docker with several examples and components of docker.

What is Docker ?

Docker is a container management platform facilitating OS level virtualisation which provides several tools such as docker client, docker server, docker hub, docker images, docker compose, etc which helps to create, manage, monitor containers.

Sounds greek? Let’s Figure it out what really docker is and why we use docker instead of a virtual machine?

First of all let’s figure it out the differences between docker and virtual machines.

Docker vs Virtual machines

You can take a view on one my post to understand the differences between docker and virtual machines which is docker vs virtual machine.

What are the problems developers have when developing a project?

There are are many problems raise when developing a project. Let’s take some which docker will help to sort it out.

  • Dependency version mismatching
  • deployment problem

What is Dependency version mismatching?

Okay. Let’s take a scenario where Rex, Peter and Chris work together in a project which needs a node 10.4.0 and angular 6 but those developers have different kind of versions as follows.

That is called as dependency version mismatching. Some might say, “Hey let’s install those versions in our machines”. But think if Peter works in several projects and those project need several dependency versions how can Peter do that?

One solution is make virtual machines and install all that dependencies separately. Great but there are some issues such as when we are going to create a virtual machine, it takes some space allocate to it and which cannot be used to any other purpose and think about we have ten separate projects and then we have to install ten virtual machines(VMs) and it is very heavy. Then what can we do?

Hey I am Docker and I am here to solve that problem

Docker is a lightweight solution and using simple few lines of codes you can make a container and install all your dependencies inside of it and run it. Even there are 10 containers it may be lighter than one VM.

Then docker is a great solution for dependency version mismatching problem.

What is deployment problem?

Next, one of the major issues which developers come a cross is that the project perfectly work on developers machine but when it on production or when it check on someone else's machine it wont work. Basically because of the dependency and library issues.

Docker give a great solution for this problem as it promises when docker container runs on one machine it will work same as on any machine.

Wow! Great! But how is it possible

In docker all the procedure to install libraries and dependencies, how to build the application, how to run the application and basically everything needed to run the application is mentioned in the docker file and when building the container it executes the procedure and build the application inside the container. Docker is based on linux OS and this procedure is valid for any machine which has docker in it. Then it will work on any machine thats how docker became portable.

Apart from those two, there are many problems which docker addresses. Then let’s identify some docker elements.

Docker file

Docker file is the file which includes the the procedure of how to install dependencies and libraries, how to build the application, how to run the application etc. Docker images and containers are build based on the docker file. Following is a sample of a docker file.

FROM alpine
RUN mkdir app && cd app
CMD sh

Docker image

Docker image is the snapshot of the file system and the startup command. It is like the setup for a program. It has all the libraries and dependencies on it. As shown in the below docker image contains two components which are file system and startup command.

  • File system has all the libraries and dependencies and build application files and folders.
  • Startup command is the command which will execute when container runs.

Docker images are immutable which means it cannot be changed. Once it created it only can be deleted.

Docker container

Docker container is an instance of the image. Container is like the program which is going to be installed using the setup(docker image). Containers are lightweight and fast when booting. You can create containers as much you want using a docker image.

Docker CLI

Docker CLI is the program which facilitate the interaction between user and Docker server. This is also called as Docker client.

Docker server.

Docker server is the one which is responsible of create images, upload images, download images, create containers, run containers, maintain containers. This is also called as Docker daemon.

Docker hub

Docker hub is the place where we can get public images and where we can upload our images for public use.

In the next post let’s discuss basic Docker commands.

If you have found this helpful please hit that 👏 and share it on social media :)




Technical Writer | Tech Enthusiast | Open source contributor

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

Recommended from Medium

AWS(Amazon Web Services) and Startups

Smaller Docker containers

Spotify’s Golden Path to Kubernetes Adoption

Building an Exchange in Rust — Part 1

How to install Ubuntu 20.04 on Hyper-V with enhanced session

Milestone achievement: itemVerse SDK/API Console and Unity SDK Beta Version Deployment

REST API with an example

Details about statu http://ift.tt/2kcHqn1

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
Yashod Perera

Yashod Perera

Technical Writer | Tech Enthusiast | Open source contributor

More from Medium

Setup Docker Container as Test environment in Local Development using shell script

Docker Basic Commands — Part 02

Introduction to Docker

Beginners: Docker & Kubernetes