Tuesday, April 7, 2020

Docker Concepts

What is docker

Docker is basically a software containerizing software. It is more like using a Virtual machine (VM), but with more advantages than using a VM.

Virtualization

Separate environments are needed to deploy and test applications, to avoid risks of damages and losses in a real environment.
Virtual machines or VMs introduced to avoid this problem. If something wrong happens in VM, just remove and create a new one

Docker vs VM

VM is just like running another machine (guest) on top of your machine (host). It simply denotes when you run a Ubuntu VM with NodeJS server on a Windows host machine, it totally costs resources like CPU, RAM, disk amount, which is needed to run two separate Windows and Ubuntu machines with its software.


(image credits: https://www.guru99.com/docker-tutorial.html)

In the same scenario above, when we are using docker, it needs only NodeJS image and a container (explained in a moment)

Glossary

Image - It is like a class in OOP. Basically defines the software attributes, resource levels permitted to use
Container - It is like an object in OOP. Container is an instance of Image. There can be multiple containers from same image. We interact with containers when executing docker
Registry - All the docker images are stored in docker registry. Docker users can get and push images to use in projects. Public and private registries are available to store images

Why Docker

Docker containers run on top of the host's Operation system.
Docker containers run in an isolated environment on top of the host's OS
Can run more containers on the same infrastructure than running more Virtual machines
Images, containers, Network interfaces are shareable
Only essential programs can be used in images, while removing unwanted programs
Easy to add and remove software from system


Disadvantages

Graphical Applications not work well
Containers are not speed as host machine installed applications
Some container products don't work with other ones
All of the data inside a container disappears forever when the container shuts down unless we use a persistent storage location





2 comments: