chapter 2 Flashcards
describe how hosting a small application in a VM can lead to inefficiencies and how a switch to containers could solve that
It can lead to inefficiencies because it would waste a lot of resources, VMs have a full operating system installation taking up a lot of storage and CPU resources, running multiple VMs each with its own operating system would use more resources than the microservices need. This would be inefficient and costly.
A switch to a container would solve this because these small environments have only the essentials: the application code and dependencies. The developer can deploy each application in its own small, isolated environment using resources optimally without extra bloat. Updates can be done smoothly and compatibility issues are gone
describe the role of the kernel in general and related to
containers
Kernel is a core component of an operating system that manages the communication between the hardware and the software of a computer. It is responsible for tasks such as memory management, process scheduling, disk management and system calls
Container does not have its own kernel or drivers, it shares the kernel of the host OS. A container only has the user mode portion of an OS, mainly the filesystem which is based on a base image. This means that the containers are limited by the host operating system and cannot run different or incompatible operating systems
explain a container image
with a container image, think of it as a snapshot or a template of a VM. It includes all the necessary files, dependencies, libraries and settings required to run a particular application or service. Its like a blueprint that defines everything needed for a container to function properly including the operating system, runtime, application code and configurations. A container image is static meaning it remains unchanged unless explicitly modified
explain a container
container is a runtime instance of a container image, its essentially a running process that is isolated from the host system and other containers. When you create a container based on a container image youre essentially instantiating that image into a live running environment, this instance is what we refer to as a container. Containers are ephemeral meaning they are designed to be easily created, started, stopped and destroyed as needed. Any changes made to a running container are typically isolated within that container and do not affect the original image or other containers
explain the role of docker hub
docker hub is a cloud based repository where you can store and share your containers images with others. It also provides a large number of public images created by the docker community. It allows you to push your images to your personal or organizational account or pull images from other sources. You can also tag your images with different versions, search for images by keywords or categories and rate or comment on images you like.
give the differences between a more regular linux like debian and alpine linux
Image size: alpine linux container images are significantly smaller than Debian images due to their minimalistic nature and the use of lightweight components. This results in faster container startup timers and reduced storage overhead
Package availability: Debian provides a vast repository of software packages offering a wide range of options, however this package availability comes at the cost of larger image sizes. Alpine linux on the other hand has a more limited set of packages available in its repositories but prioritizes simplicity and security
Runtime performance: alpine linuxs lightweight design often leads to better runtime performance in terms of resource utilization and container responsiveness compared to Debian. The reduced overhead of unnecessary components contributes to improved efficiency, especially in resource contrained environments
explain what happens when you run docker run for the first time
When you run docker run hello-world the docker engine running in your terminal tried to find an image named “hello-world” since this is the first time running a docker run command there are no images stored locally, so docker engine goes to its default docker registry, which is docker hub, to look for an image named “hello-world”
explain docker run
creates and starts a new container
explain docker start
starts one or more stopped containers
explain docker stop
stops one or more containers
explain docker rm
removes one or more stopped containers
explain docker ps
lists containers
explain docker exec
runs a command in a running container
explain docker attach
attaches to a running containers console