0% found this document useful (0 votes)
59 views

Docker Part1

The Docker CLI allows users to interact with the Docker daemon from the command line to manage containers, images, networks and volumes. Commonly used commands include docker run to create and start containers, docker pull to download images, docker build to build images from Dockerfiles, and docker ps to list running containers.

Uploaded by

anbuchennai82
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views

Docker Part1

The Docker CLI allows users to interact with the Docker daemon from the command line to manage containers, images, networks and volumes. Commonly used commands include docker run to create and start containers, docker pull to download images, docker build to build images from Dockerfiles, and docker ps to list running containers.

Uploaded by

anbuchennai82
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Docker Engine, often simply referred to as "Docker," is the core component of the Docker platform.

It
is responsible for creating and managing containers on a host system. The Docker Engine includes
several key components and functionalities:

1. Docker Daemon (dockerd): The Docker Daemon is a background service that manages Docker
containers on a system. It listens for Docker API requests and performs actions like building, running,
and stopping containers. The Docker Daemon communicates with the Docker CLI and other Docker
components to execute commands and manage containers.

2. Docker CLI (Command-Line Interface): The Docker CLI is a command-line tool that allows users to
interact with Docker. Users can issue commands to the Docker CLI to create, manage, and inspect
containers, images, networks, and volumes.

3. Container Runtime: Docker Engine uses a container runtime to run containers. In the past, Docker
primarily used its own runtime called "containerd." However, Docker has evolved to support multiple
container runtimes, including containerd and others like runc. These runtimes are responsible for
creating and managing containers, providing isolation, and interacting with the host operating
system's kernel.

4. Docker Images: Docker Engine uses Docker images as the building blocks for containers. Images
are read-only templates that contain instructions for creating a container. Images are typically
layered, which means they consist of a base image and additional layers with changes and
dependencies. Images are stored in a local repository on the host system.

5. Container Networking: Docker Engine includes networking capabilities that allow containers to
communicate with each other and with external networks. Docker can create virtual networks and
attach containers to them, enabling various networking configurations and isolation.

6. Storage Management: Docker Engine provides mechanisms for managing data storage for
containers. This includes the ability to create and manage data volumes, which are persistent storage
areas that can be shared between containers.

7. Security and Isolation: Docker Engine ensures that containers are isolated from each other and
from the host system, providing a level of security. It uses technologies like namespaces and control
groups (cgroups) to achieve this isolation.

8. Integration with Registries: Docker Engine can pull Docker images from Docker registries, such as
Docker Hub or private registries, to create containers. Images can also be pushed to registries for
distribution and sharing.

9. Docker Compose Integration: Docker Engine can work in conjunction with Docker Compose,
allowing users to define and manage multi-container applications using a YAML configuration file.

Docker Engine has been a fundamental tool in the containerization and microservices movements, as
it simplifies the process of packaging, distributing, and running applications within containers.
However, it's important to note that the container ecosystem is dynamic, and other container
runtimes and orchestration tools have emerged alongside Docker to address specific use cases and
requirements.
Docker Daemon (dockerd):
The Docker daemon, often referred to simply as "Docker," is a background service that runs on a host
machine and is responsible for managing Docker containers. It is a critical component of the Docker
platform and handles requests from the Docker CLI (Command-Line Interface) and Docker API to
create, run, stop, and manage containers.

Here are key points about the Docker daemon:

1. Background Service: The Docker daemon operates as a long-running background service or


process. It starts automatically when the host system boots up and continues to run until the system
is shut down or the Docker service is stopped explicitly.

2. REST API: The Docker daemon exposes a REST API that allows clients to interact with it. The
Docker CLI communicates with the daemon via this API, sending requests to create containers,
manage images, and perform other Docker-related tasks.

3. Container Management: The Docker daemon is responsible for creating, running, and managing
containers. It interacts with the host operating system's kernel to create and manage containerized
environments, known as namespaces and control groups (cgroups).

4. Image Handling: Docker images are managed by the daemon. It can pull images from Docker
registries, store them locally, and use them to create containers. Images are cached to improve
performance and reduce duplication when multiple containers use the same image.

5. Network Management: The Docker daemon manages networking for containers. It creates and
manages network interfaces and IP addresses for containers, enabling them to communicate with
each other and with the host system.

6. Volume Management: Docker volumes, used for persisting data, are managed by the daemon. It
creates and manages the volumes that containers can use to store and share data.

7. Logging and Monitoring: The Docker daemon logs container events and maintains container logs.
It also provides basic monitoring capabilities, such as container resource usage statistics.

8. Security: The Docker daemon plays a key role in container security. It isolates containers from each
other and from the host system by leveraging various Linux kernel security features, including
namespaces and cgroups.

9. Authentication and Authorization: The Docker daemon enforces authentication and authorization
policies to ensure that only authorized users and applications can interact with it. Access control can
be managed using user privileges and groups.

10. Dockerd: The Docker daemon process is typically named "dockerd" and can be started manually
or managed as a system service depending on the host operating system. On Linux, it's often
managed by a system init system (e.g., systemd or upstart).

11. Configuration: The Docker daemon's behaviour can be customized through configuration files,
such as the Docker configuration file (usually located at `/etc/docker/daemon.json`). These files can
be used to specify various settings, including network configuration, storage drivers, and more.

12. Swarm Mode: In addition to managing standalone containers, the Docker daemon can operate in
Swarm mode to manage clusters of Docker nodes, providing features for container orchestration,
scaling, and service management.
Understanding the role and functionality of the Docker daemon is essential for effectively using
Docker to manage containers and containerized applications. Docker provides a well-documented
API that allows for interaction with the daemon programmatically, making it versatile for various
automation and orchestration scenarios.

Docker CLI:
The Docker CLI (Command-Line Interface) is a command-line tool that allows users to interact with
the Docker daemon and manage Docker containers, images, networks, volumes, and other Docker-
related resources. The Docker CLI provides a comprehensive set of commands and options for
performing various containerization tasks.

Here are some commonly used Docker CLI commands and their purposes:

1. docker run: This command creates and starts a new container based on a specified Docker image.
You can use various options to configure the container, such as specifying environment variables,
ports, and volumes.

docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

2. docker pull: Pulls (downloads) a Docker image from a registry, such as Docker Hub, to the local
machine, making it available for creating containers.

docker pull IMAGE[:TAG]

3. docker build: Builds a Docker image from a Dockerfile and a specified build context directory. It
allows you to customize and create your own images.

docker build [OPTIONS] PATH | URL | -

4. docker ps: Lists the running containers on the local machine. The `-a` option can be used to list all
containers, including those that have exited.

docker ps [OPTIONS]

5. docker stop and docker start: These commands are used to stop and start containers, respectively.
You can specify the container name or ID as an argument.

docker stop CONTAINER [CONTAINER...]

docker start CONTAINER [CONTAINER...]

6. docker exec: Runs a command inside a running container. This is useful for executing ad-hoc
commands or accessing a container's shell.

docker exec [OPTIONS] CONTAINER COMMAND [ARG...]

7. docker logs: Displays the logs generated by a running container. You can specify the container
name or ID.

docker logs [OPTIONS] CONTAINER

8. docker images: Lists the Docker images available on the local machine. The `-a` option shows all
images, including intermediate layers.

docker images [OPTIONS]

You might also like