Deck 1 - Introduction to Docker and Kubernetes Flashcards
What is containerization?
Containerization is a software which enables operating system to create multiple isolated user-space for applications.
Operating system could be running on physical hardware or virtual machine
What is created when a container is created is it Kernel space or user space?
User space is created for isolation. It uses linux utilities called namespace to isolate one container from other.
Containerization vs Virualization
1) Containerization is to segregate application from the underlying OS. While virtualization is a way to create VM from hardware resources.
Cloud providers use mix of both.
2) In containerization it is easy to move software from one computing environment to another. Eg. from Dev -> Staging -> Production.
Virtual machine guest is more tightly tied to the underlying hypervisor and movement of application from dev to staging to production environment requires more effort.
3) Containers consumes less CPU, memory and disks.
While applications running on virtualization requires full stack of resource and result in more waste of resources.
4) Containers are more in line with the devops approach. It is more agile and easy to manage than virtualization.
Virtualization management is also easy but when it comes to port applications between different environment then it requires more efforts.
How should we use baremetals? One way is either create one large machine and run multiple containers on top of the VM. Or create individual VMs and then deploy containers.
In the first approach we get more computing resources and it will be faster as containers are running directly on top of OS.
In case of other approach it will be bit slower as there is one additional hop that needs to be jumped. But it is more resilient as even if one VM goes down we have other VM to work with.
It is a tradeoff.
What are containers?
Containers are type of virtualization technology which uses host operating system kernel to run multiple guest instances.
Container is nothing but running instance of image. Image consists of libraries, binaries and the corresponding RootFS required by container to run.
What is docker?
Docker is a container engine that is used to create containers.
What things does each container have its own?
Root file system Networking IPs and ports, hostnames Processes Devices Memory
A container will not show process related to other containers or host machine.
You can assign memory and CPU to container. This can be done using docker or by kubernetes. Both have different ways.
What is used to map networking from docker container to host machine networking?
There is a bridge called docker0, which takes care of mapping the network interface inside the container to network interface on the host machine.
Which linux kernel features does docker use to achieve containerization?
It uses cgroups, namespaces, chroot and others to provide resource isolation.
Is the statement “Docker enables containerization” true? And elaborate
No, docker uses kernel to achieve containerization. It is the inherent property of underlying OS to enable containerization. That is why till long time docker did not support windows as there was no support for containerization in Windows.
Docker enables management of containers and images.