Skip to content
IT glossary
DevOps and cloudUpdated December 3, 2026

Docker

Docker packages an application and its dependencies into an image. You can use that image to start the application in an isolated environment called a container.

Also known as: докер

What problem does Docker solve?

Suppose your app runs on your laptop but fails on the build server because a library is missing. Instead of installing that library separately on every machine, you can package it with the app in a Docker image. Running the image creates a container. You can create several containers from the same image: each gets its own writable filesystem layer, so changes in one container don't modify the image or the others.

From source code to a running container

A Dockerfile describes how to assemble an image: choose a base image, install dependencies, copy the application, and set a default startup command. Docker can reuse cached build steps. For example, if you copy the dependency manifest and install dependencies before copying your source code, editing a source file need not trigger another dependency installation. A finished image can be pushed to a registry and pulled by a CI runner or a server.

A Linux container runs processes that share the Linux kernel of the system running them. Namespaces give those processes separate views of resources such as process IDs and network interfaces. Control groups (cgroups) track resource usage and can enforce limits. A virtual machine, in contrast, boots its own kernel. When Docker Desktop runs Linux containers on macOS or Windows, that shared Linux kernel runs inside a VM.

Try it with a web server

docker run --rm -p 127.0.0.1:8080:80 nginx:alpine

Docker pulls the image if it's not already available locally and starts Nginx. Open http://127.0.0.1:8080 on your machine: Docker forwards requests from host port 8080 to port 80 in the container. Binding to 127.0.0.1 keeps the published port local to the host. The --rm flag removes the container when it exits, not the image.

Where it fits in a workflow

For local development, Docker Compose can describe an app, its database, and their network in one YAML file. In CI/CD, a team can build an image once, test it, and deploy that same artifact. Referencing it by digest rather than by a mutable tag such as latest ensures you select the intended image. Runtime configuration still matters: two containers from the same image can use different environment variables, networks, and mounted files.

Common mistakes and interview scenarios

Don't keep database files in the container's writable layer if they need to survive replacement. Stopping the container leaves that layer intact; removing the container discards it. Mount a named volume at the database's data directory so a replacement container can use the same files. A volume is not a backup.

Interviewers often ask why a running container isn't reachable from the host. Check that the process is listening on the expected port and isn't bound only to the container's loopback interface. Then check the host-to-container port mapping: EXPOSE in a Dockerfile documents an intended port but doesn't publish it by itself.