๐€๐ซ๐œ๐ก๐ข๐ญ๐ž๐œ๐ญ๐ฎ๐ซ๐ž ๐จ๐Ÿ ๐ƒ๐จ๐œ๐ค๐ž๐ซ

Megha Sharma - Oct 19 - - Dev Community

Image description
Docker uses a client-server architecture. The Docker client talks to the Docker daemon, which does the heavy lifting of building, running, and distributing your Docker containers. 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. Another Docker client is Docker Compose, that lets you work with applications consisting of a set of containers.

๐‚๐จ๐ฆ๐ฉ๐จ๐ง๐ž๐ง๐ญ๐ฌ ๐จ๐Ÿ ๐ƒ๐จ๐œ๐ค๐ž๐ซ:

Image description

๐Ÿ‘‰ Docker Engine: The core of Docker is the Docker Engine, which is responsible for building, running, and managing containers. It includes a server, a REST API, and a command-line interface (CLI) that facilitates communication with the Docker daemon.

๐Ÿ‘‰ Docker Compose: Docker Compose is a tool for defining and running multi-container Docker applications. It uses a YAML file to configure the applicationโ€™s services, networks, and volumes, allowing for easy management of complex multi-container setups.

๐Ÿ‘‰ ๐ƒ๐จ๐œ๐ค๐ž๐ซ ๐ƒ๐š๐ž๐ฆ๐จ๐ง: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.

โ€ข Docker daemon runs on host O.S.
โ€ข It is responsible for running containers to manages docker services.
โ€ข Docker daemon can communicate with other daemons.

๐Ÿ‘‰ ๐ƒ๐จ๐œ๐ค๐ž๐ซ ๐‚๐ฅ๐ข๐ž๐ง๐ญ: 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.

โ€ข Docker users can interact with docker through a client.
โ€ข Docker client uses commands and REST API to communicate with the docker daemon.
โ€ข When a client runs any server command on the docker client terminal, the client terminal sends these docker commands to the docker daemon.
โ€ข It is possible for docker client to communicate with more than one daemon.

๐Ÿ‘‰ ๐ƒ๐จ๐œ๐ค๐ž๐ซ ๐‚๐ฅ๐ข๐ž๐ง๐ญ: 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.

โ€ข Docker users can interact with docker through a client.
โ€ข Docker client uses commands and REST API to communicate with the docker daemon.
โ€ข When a client runs any server command on the docker client terminal, the client terminal sends these docker commands to the docker daemon.
โ€ข It is possible for docker client to communicate with more than one daemon

๐Ÿ‘‰ ๐ƒ๐จ๐œ๐ค๐ž๐ซ ๐‡๐จ๐ฌ๐ญ:
โ€ข Docker host is used to provide an environment to execute and run applications.
โ€ข It contains the docker daemon, images, containers, networks and storages.

๐Ÿ‘‰ Docker Networking: Docker provides a range of networking options for connecting containers, allowing them to communicate with each other or with external networks. Docker creates default bridge networks, but users can define custom networks as needed.

๐Ÿ‘‰ Docker Volumes: Docker volumes provide persistent storage for containers. They allow data to be shared between the host and the container, as well as between different containers. Volumes are a way to manage and persist data generated by Docker containers.

๐Ÿ‘‰ ๐ƒ๐จ๐œ๐ค๐ž๐ซ ๐‡๐ฎ๐›/ ๐‘๐ž๐ ๐ข๐ฌ๐ญ๐ซ๐ฒ:
โ€ข Docker registry manages and stores the docker image.
โ€ข There are two types of registries in the docker:
a) Public Registry: it is also called as docker hub.
b) Private Registry: it is used to share image with in the enterprise.

A Docker registry stores Docker images. Docker Hub is a public registry that anyone can use, and Docker looks 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, Docker pulls the required images from your configured registry. When you use the docker push command, Docker pushes your image to your configured registry.

๐Ÿ‘‰ ๐ƒ๐จ๐œ๐ค๐ž๐ซ ๐ˆ๐ฆ๐š๐ ๐ž:

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. For example, you may build an image which is based on the ubuntu image, but installs the Apache web server and your application, as well as the configuration details needed to make your application run.

You might create your own images or you might only use those created by others and published in a registry. To build your own image, you create a Dockerfile with a simple syntax for defining the steps needed to create the image and run it. Each instruction in a Dockerfile creates a layer in the image. 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.

Ways to Create an Image:
a) Take image from the docker hub.
b) Create image from docker file.
c) Create image from existing docker containers.

Image description

๐Ÿ‘‰ ๐ƒ๐จ๐œ๐ค๐ž๐ซ ๐‚๐จ๐ง๐ญ๐š๐ข๐ง๐ž๐ซ๐ฌ:

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. You can connect a container to one or more networks, attach storage to it, or even create a new image based on its current state.

By default, a container is relatively well isolated from other containers and its host machine. You can control how isolated a containerโ€™s network, storage, or other underlying subsystems are from other containers or from the host machine.

A container is defined by its image as well as any configuration options you provide to it when you create or start it. When a container is removed, any changes to its state that arenโ€™t stored in persistent storage disappear.

โ€ข Containers hold the entire packages that is needed to run the application. In other words, we can say that the image is a template and the container is a copy if that template.
โ€ข Container is like a virtual machine.
โ€ข Images becomes container when they run on docker engine.

Image description

Example Docker Run Command

docker run -i -t ubuntu /bin/bash
Enter fullscreen mode Exit fullscreen mode

When you run this command, the following happens:

  1. If you donโ€™t have the ubuntu image locally, Docker pulls it from your configured registry, as though you had run docker pull ubuntu manually.

  2. Docker creates a new container, as though you had run a docker container create command manually.

  3. Docker allocates a read-write filesystem to the container, as its final layer. This allows a running container to create or modify files and directories in its local filesystem.

  4. Docker creates a network interface to connect the container to the default network, since you didnโ€™t specify any networking options. This includes assigning an IP address to the container. By default, containers can connect to external networks using the host machineโ€™s network connection.

  5. Docker starts the container and executes /bin/bash. Because the container is running interactively and attached to your terminal (due to the -i and -t flags), you can provide input using your keyboard while Docker logs the output to your terminal.

  6. When you run exit to terminate the /bin/bash command, the container stops but isn't removed. You can start it again or remove it.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player