General Flashcards
Which one is more portable: containers or VMs?
Containers. They are more lightweight and therefore, more portable
Can containers run inside VMs?
Yes
Are the majority of containers in circulation Linux or Windows based?
Linxus based. They are smaller than Windows containers
What is Docker?
Docker is a platform for building and managing containers
Since Docker is Linux based, how is it possible for it to run on Windows or Mac?
Docker runs inside a VM for Windows (WSL 2) and Mac
Give an illustration of Docker’s architecture
- Docker Client (CLI, Docker Desktop communcaties with dockerd)
- dockerd (Restful API that delegates to containerd)
- containerd (Manages the lifecycle of containers)
- runc (container runtime that executes containers)
- Host OS
- Host hardware
Describe the role of dockerd
dockerd provides an API to docker clients. It delegates most of the work to containerd
Describe the role of containerd
containerd manages images and the lifecycle of containers. it uses instances of runc to build, run, and remove containers by passing an image to it
What is the role of runc
runc is a stand-alone container runtime that interacts with the host OS to build, run, and remove containers. As soon as containers are built, runc terminates and the containerd’s shim process becomes the parent process for the running container. This is done so that Docker avoids having dozens of runc instances for running containers
Is a docker host and a docker node the same thing?
Yes
What is the role of a shim?
To become the parent process of a container after runc creates it. It also reports back to containerd when a container terminates
What is a container?
A container is an instance of an image
What is a Dockerfile?
A Dockerfile is a file containing all of the instructions necessary to build a container image. Dockerfiles are normallyu located in the root directory of an application.
docker build [Options] [path]
Is the command used to build images by specifying the path to the Dockerfile
What is an image and what is it composed of?
An image is a template for building containers. It is composed of a stack of independent layers where the base layer is usually a lightweight OS (no kernel) that provides a CLI to interact with the container
What is a registry?
A registry is a collection of repositories for images. Docker Hub is the default registry for Docker Desktop
Give an illustration of the structure of a registry
- Registry
- N Repositories per registry
- N images per repository
What happens when you don’t specify a tag when pulling an image?
The “latest” tag is used implicitly
True or False
It’s a good practice to specify the version of the image you are pulling instead of using the “latest” tag
True
How do image layers make images more space efficient?
Image layers can be shared by different images. This means that image layers can be stored locally and be reused by multiple images
What is a digest and why is it used?
A digest is a hash over the contents of an image. It is used so that an image can be recognized even if it happens to have the same name as another image but with older code
What is a manifest list and what is it used for?
A manifest list is a list of the CPU architectures that an image supports. Each CPU architecture has its own manifest that lists the layers used to build that image. This makes it easy to pull images with the right CPU architecture since Docker pulls the proper image by parsing the manifest list
If you have 2 images stored locally and they have some layers in common, will deleting one of the images remove all of the layers stored locally?
No. If there is another image that shares some of the layers, those layers that are being shared will not be deleted until the second image is deleted
What is Docker buildx?
Docker buildx is a plugin that extends the Docker CLI to support multi-arch builds
What happens if you kill the main process (PID 1) of a container?
The container will also be killed