Docker is a popular software packaging, distribution and execution infrastructure using containers (Overview):
-
Docker runs on Linux only (LXC). MacOS and Windows have developed adapter technologies.
-
Windows uses an internal Linux VM to run the Docker engine (or the Docker daemon process: dockerd ).
-
Client tools (CLI, GUI, e.g. Docker Desktop) are used to create, manage and execute containers.
First introduction (2013): Salomon Hykes at PyCon 2013, Santa Clara CA: "The Future of Linux Containers" (video, 5:21min).
Docker builds on Linux technologies:
-
Stackable layers of filesystem images that each contain only the changes to an underlying image.
-
Tools to build, manage and distribute images ("ship container" metaphore).
-
Linux LXC or similar technology is used to "run containers" as groups of isolated processes on a Linux system.
Docker is used to:
-
Aquire, deploy and use software (e.g. MySQL database) without installation on the host system.
-
Package own software and "ship-as-a-container" rather than in proprietary formats that require installation in the target environment.
Packaging and distributing software as a container becomes part of the software build process.
Docker core concepts:
-
Image - compound of stacked images (image layers) starting with a base image that yields a final filesystem impression that is visible inside a container.
- Each image layer can be created and distributed independently.
- Each image is built by a Dockerfile.
-
Registry - local or global repository to share images, e.g. Docker Hub.
-
Container - Information (state) comprised of:
- Id, name,
- Reference to an image (top of image stack),
- Entry point, arguments, environment variables,
- Ports, mounted volumes, etc.
-
Running Container instance - Process group executing on the state of a Container. Process groups of one container are fully isolated from state of other containers and the state of the host system.
-
Orchestration of Container instances (docker-compose) - from sets of containers, e.g. a database container and an application container. Combine configuration and life cycle control in a single
docker-compose.yaml
file.
Basic docker commands:
-
Image lifecycle commands (lifecycle: states over creation, existence, removal):
docker build | rmi
(rmi: remove image),docker pull | push
from/to a registry.
-
Container lifecycle commands:
docker run | start | stop | rm
(rm: remove container).docker exec
- attach processes to container.
-
Inspection commands:
- show images:
docker images
, - show containers:
docker ps -a
(existing and running containers-a
), - show output:
docker logs
.
- show images:
Docker Overview:
Stackable images:
For further reference, find information at links:
- Getting Docker (installation), here.
- Docker Reference, here.
- Docker Commands, here, cheatsheet
- Dockerfile cheatsheet.
- Docker Hub, link.
- Orchestration (docker-compose)
- Compose Reference, here,
- docker-compose cheatsheet.
- Docker Meetup Berlin, past events, upcoming.
- DockerCon'22, May 9-10, 2022, link, YouTube.
- Salomon Hykes at PyCon 2013, Santa Clara CA: "The Future of Linux Containers" (video, 5:21min).