Docker

Table of Contents

home
slides

1. What’s docker?

Docker provides the ability to package and run an application in a loosely isolated environment calld a container. The isolation and security allow you tu run many containers simultaneously in given host. Containers are lightweight because the don’t need the extra load of a hypervisor, but run directly within the host machine’s kernel. This means you can run more containers on a given hardware combination than if you were using virtual machines. you can even run Docker containers within host machines that are actually virtual machines.

2. Docker engine

Docker engine is a client-server application with these major components:

Server (docker daemon) –> REST API -> CLI (Docker command)

2.1. A server

Which is a type of long-running program calld a daemon process (the dockerd command)

2.2. A REST API

Which specifies interfaces that programs can use to talk to the daemon and instruct it what to do.

2.3. A CLI

A command line interface client, specificly the docker command.

3. Docker architecture

Docker uses a client-server architecture. The docker clien talks to the docker daemon, the docker client and daemon can run on the same system, or you can connect a Docker client to a remote Docker daemon, the Docker client and daemon communicate using a REST API, over UNIX sockets or a network interface.

Docker architecturetaken from https://jfrog.com/knowledge-base/the-basics-a-beginners-guide-to-docker/

3.1. The Docker daemon

The Docker daemon (dockerd) listens for Docker API requests and manages Docker objects such as images, containers, networks, and volumes. A daemon can also communicate with other daemons to manage Docker services.

3.2. The Docker client

The Docker client (docker) is the primary way that many Docker users interact with Docker. When you use commands such as docker run, the client sends these commands to dockerd, which carries them out. The docker command uses the Docker API. The Docker client can communicate with more than one daemon.

3.3. Docker registries

A Docker registry stores Docker images. Docker Hub is a public registry that anyone can use, and Docker is configured to look for images on Docker Hub by default. You can even run your own private registry. When you use the docker pull or docker run commands, the required images are pulled from your configured registry. When you use the docker push command, your image is pushed to your configured registry.

4. Docker objects

When you use Docker, you are creating and using images, containers, networks, volumes, plugins and other objects.

4.1. IMAGES

An image is a read-only template with instructions for creating a docker container, often, an image is based on another image, with some additional customization. You may build an image which is based on the ubuntu image, but installs Apache web server and additional apps, as wll as the configuration details needed to make your app run.

You might create your own images or only use those created by others and published in a registry.

When you change the Dockerfile and rebuild the image, only those layers which have changed are rebuilt. This is part of what makes images so lightweight, small, and fast, when compared to other virtualization technologies

4.2. Containers

A container is a runnable instance of an image, you can create, start, stop, move or delete a container using the Docker API or CLI. A container is defined by its image as well as any configuration options you provide to it when you create or start it. When acontainer is removed, any changes to its state that are not stored in persistent storage disappear.

Author: Andres Amezquita

Created: 2023-04-16 dom 00:51