What is docker and how could you use it over virtual machines?

Manish Kumar Thota
Analytics Vidhya
Published in
5 min readJun 29, 2020

Docker allows you to create independent and isolated environments. A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application.

To all the non-tech geek’s let’s understand dockers by using some Real-world problems

Case 1:

Assume that you’re relocating or leaving one dwelling and settling in another, during this process you need to pack all your belongings which might include your Television, Refrigerator, washing machine, Dining table, Sofa set, Etc. and shift it to your new house. For instance, think that you’re shifting the items one by one and amid this, there may be a possibility that you might miss an item due to various reasons thus leading to a problem.

Better we put all the items in one container and just take everything as a whole i.e. in proper discipline and unpack them in the new house, having a very less probability of missing the items.

Case 2:

In a company, there is a scenario where a developer is working on a web application and this person has windows operating system and ‘X’ hardware configuration, while the application is deployed in the developer’s machine that could be easily tested by the developer i.e. prone to zero bugs. Now the same web application is sent to the testing team for further assessing. Let’s assume that the testing team has Linux Operating system and ‘Y’ hardware configuration, during this testing, there is a possibility that the web application developed by the developer might not work on the tester’s machine throwing lot and lots of bugs due to the huge variations in the compatibility of the machines.

How to prevent it? The developer should put the whole application into a container, more precisely a docker container. An image of the QnA’s configuration is put on the developer side while sending the web application to the tester and letting them install and run in their environment.

Build once and deploy anywhere……

Advantage of Dockers over virtual machines

In every server, you have four most essential things and those are CPU, RAM, Network capabilities(port numbers where the web applications run i.e 5000/8000), Harddisk. On top of every web server, we try to create virtual machines in which we allocate some amount of CPU, RAM, Hardisk, and Let’s say you have 1TB capacity of hard drive and you allocate 200GB to each virtual machine.

  • Environment standardization works pretty much fine with the virtual machines as we can install all the libraries and the requirements in a stand-alone environment which is separate from the rest of the virtual machines
  • Isolation of environments from the rest doesn’t hinder any problem for the current working environment.

But the problem lies in resource usability and portability .

The way Dockers solve this problem is by using virtualization, here dockers are created on the top of OS and each docker will have process ID(PID), Network configuration and user root folder. now assume that you have created 4 dockers d1, d2, d3, d4, and let’s say d2 is not working then you can use its resources for performing operations on the rest of the dockers, hence solving resource usability and portability.

Containers Are More Agile than VMs and their applications share common operating systems and software libraries which greatly improves CPU utilization within a VM. This means an organization can reduce the overall number of virtual machines needed to operate their environment and increase the number of applications that can run on a server. Docker Enterprise customers often see 50% increased server consolidation after containerizing which means fewer hardware costs and savings on VM and OS licensing. Isn’t this a great way to gain profits…

Installation of docker in your machines

You can download dockers by clicking the link https://docs.docker.com/docker-for-windows/install/, just make sure that your system is compatible with the download. The above link directs you to dockers for Windows OS but there are options for other OS’s as well, you can have a look at it.

In case you have windows home edition then you need to download docker toolbox from here https://github.com/docker/toolbox/releases and trust me guys, if you can install any of the mentioned releases of the toolbox in the first place then you are lucky because literally, I spent 30 minutes to figure out which release would be compatible for my system thanks for my internet though!. How to figure out the compatibility? After the installation, open your docker terminal and wait for a few minutes until you see something like this 👇

Version 18.09.0-ce

If you are not able to get this then just uninstall the virtual box, docker toolbox, and proceed to download another release.

I hope you all got a clear understanding of what is docker and its relevance.

If you like my writing then give a clap which makes me write more interesting content in the future, also share with your friends.

Stay safe

support my work ❤️

keep coding!

Manish Kumar

Data Science Enthusiast

--

--