Skip to content

QUESTIONS

Questions for tech checks:

✔️ Explain the architecture of Docker.

Built on the principles of microservice architecture (many services, each with its own area of responsibility). Docker components are standardized, which has enabled the development of different implementations of these components. - Client (Docker CLI) — a program that helps form commands. - Docker API (daemon) — essentially a REST API that accepts commands, performs initial processing such as validation, and passes them further down the execution chain. - Lifecycle Management (containerd) — a program responsible for the container lifecycle and commands such as start, stop, and pause. - Low-Level Runtime (runc) — a component responsible for abstracting work with the Linux kernel.

SonarCube ✔️ What is the difference between a Docker Image and a Docker Container?

Image - a template, just like in programming a class serves as a template for subsequent object instances. Container - a specific instance of an image.

✔️ What advantages does Docker have over virtual machines?

Virtual machines fully virtualize an operating system, thereby consuming much more resources from the host system, while containerization uses the Linux kernel shared with the host machine and creates its own instances of the file system, network settings, users, and access rights. A container is also an isolated zone of the operating system.

✔️ How do you create a Docker container?

Create a Dockerfile with the proper syntax and fill in this file so that it describes which base image the container will be created from, the working directory, copying of necessary files, and application startup commands. Then, if the syntax is correct, run docker build with the appropriate flags — this creates an image — after which run docker run with the appropriate flags to create and start the container.

✔️ What is the difference between a registry and a repository?

A registry is a server/service that contains repositories (for example, Docker Hub or Amazon ECR), while repositories are storage locations for specific images of projects in different versions.

✔️ What is the purpose of the EXPOSE and publish (-p) commands in Docker?

EXPOSE only declares that certain ports in the application will be mapped, without actually performing the mapping (it is just metadata). publish (-p) during container creation actually maps the host port to the container port.

✔️ Describe the container lifecycle.

A container lives from creation to deletion. A container created from an image is ready to start; in this state, it is not running and does not consume resources. The running state means the container is started and working. A container can also be paused and unpaused; in a paused state, the container does not consume host resources but remembers the stopping point. The stopped state effectively sends a SIGTERM to the container, which gracefully terminates the container, or stopped via kill, which forcefully terminates the container. A stopped container can also be removed.

✔️ What is a Docker Volume?

A storage shared with the host machine, which is generally used as shared storage between different containers to share files and databases.

✔️ How do you run a container in docker-compose?

Properly write all Dockerfiles, then write the docker-compose.yml file in the specified format, and then run it with the command docker compose up -d