Docker Architecture & O.S Virtualization in Docker
Prerequisite: https://bansalkushagra.medium.com/what-is-docker-b263c216a714
Docker is a tool that performs OS-level Virtualization instead of Hardware-level Virtualization. Docker works on PAAS(Platform as a service).
Docker is natively for Linux machines. Earlier we discussed docker doesn’t contain an operating system technically it's not true containers do contain O.S but the size of their own O.S is negligible compare to Host Operating System.
Here suppose our O.S is RHEL Unix-like operating system. Now using docker we download an image of ubuntu which is also a Unix-type Operating System. Since here we are using Ubuntu image which dependencies, files, configurations are 95 % same as RHEL O.S in host system then why have another Virtual Machine with a separate O.S.
Now, the key problem is what if Windows is the host O.S?
Windows launch a feature to enable a virtualization system i.e hyper-v available in windows 10 pro. Docker also provides software that helps to connect our system to the docker hub. Also if we run Linux image on windows as docker we installed in our machine contains all necessary configuration files of Linux.
Images created cannot be modified/change but when run as a container, we can modify inside of an image like installing/deleting the software. Images are like snapshots of a machine.
Advantages of docker =>
A. Lightweight
B. Less cost because of fewer resources requirement.
C. O.s level Virtualization
D. Reusability of an image
E. CI efficiency
F. took less time to create a container
Limitations:
A. Docker is not cross-platform compatible. Means container run in windows will only run on other windows O.S.
B. Not good solution for application that requires rich GUI
C. Difficult to manage a large number of Containers
D. Docker is suitable when the Development O.S and Testing O.S are the same. Eg: If the dev team uses ubuntu a Linux-Distribution and the Testing Team uses Centos which is also a Linux Distribution then the docker container will not work in both the environment because some files used by OS in both cases may differ which creates incompatibility to run the containers
E. No solution for Data Recovery and Backup
Docker Architecture:
Docker file, Here, We write necessary dependencies/ requirement software as per the requirements. This DockerFile executes/run on Docker Engine/Daemon. At initial DockerFile creates an image and then container using the image with every soft mentioned in a docker file. Also, we can push our image on the Docker hub using this another user can access our image if we publicly push over the docker hub. The container is also known as Layered File System. It means the container will execute line by line in a sequence way, not in a parallel way.
Containers are rendered using a variety of different items that we call the Docker Ecosystem.
Docker Ecosystem =>
A. Docker Client: Here we use to create docker file.
B. Docker Daemon: It is a docker Engine used to create an image into the container.
C. Docker Hub: All images are available here. Or can store our images. Also known as Registry.
D. Docker Image: It is just like a template that is used to create an image.
E. Docker Compose: WE can Run multiple dockers or say manage.