Chapter nine analyzes with you after blasting Docker architecture

This series of articles:


Chapter one: nine analyze with you after blasting Docker installation

Chapter two:Nine analysis with you after blasting Docker architecture

table of Contents

1 Docker architecture

2 Docker components

3 Docker process

    3.1 client process

    3.2 server process

    3.3 registry process


1 Docker Chart

Screenshot .png

        I think a good architecture diagram to do three things, first: To demonstrate that all critical components; Second: To clearly define the relationship of these components primary and secondary level, scope and communications. Third: to be simple enough that people can glance. I think above all architecture diagram has been done.

        docker by the client (Client), the server (Docker daemon, referred dockerd) and a registration server (Registry) of three components, are typically c / s architecture. Wherein the operation target server-side components are: a mirror (image) and the container (container). docker various components can be on the same host or on different hosts. Therefore, Docker can no longer be seen as simple tools, but should be seen as a platform.


2 Docker components

        docker three components carry out their duties, where you can use a production and processing enterprises analogy.

        1) docker client: administration. Daemon is responsible for the organization of work to docker.

        2) docker registry: warehousing sectors. Responsible for storing raw materials (image).

        3) docker daemon: production sector. Warehousing and communications sector, access to raw materials; and communication management, given the task of producing goods (container).


3 Docker process

        Docker not installed by default registry case. and client daemon package paths are as follows:

        1)  client:  /usr/bin/docker

        2) daemon: /usr/bin/dockerd

Screenshots (5) .png

3.1 client process

        客户端进程生命周期很短,从发送命令给 daemon,再到 daemon 响应返回、打印到控制台,往往几秒钟就结束了。下图是客户端进程的一个快照。

Screenshots (6) .png

3.2  服务端进程

        可以直接使用如下命令来启动服务端进程。

ff.png

        但是一般情况下,docker 安装程序会将服务端封装成一个操作系统后台服务,然后交给系统控制器 (systemctl) 来统一进行管理。这样做的好处是以后可以只通过名称(docker)而不是路径(/usr/bin/dockerd) 来管理后端服务了。

sudo systemctl enable docker

sudo systemctl start docker

sudo systemctl stop docker

sudo systemctl restart docker

sudo systemctl status docker

        后台服务配置文件路径 /usr/systemd/system/docker.service。截图如下:

Screenshot (2) .png

        从截图可以看出系统服务运行时会依赖哪些其他服务(Unit单元)、真正调用的后台程序是(/usr/bin/dockerd)、资源限制(Limit)、重启策略(Restart)等。

        执行如下命令启动服务端进程。

sudo systemctl start docker

ps aux | grep dockerd | grep -v grep

Screenshot (3) .png3.3 registry 进程

        这里首先要区分两个概念:registry 和 repo。repo 仅仅表示存储概念,而 registry 是 repo + 认证(鉴权、授权)。也就是说仓库并不是谁访问都可以,它还需要有一个认证和准入的操作。

        In addition, registry as well as public and private points. docker default is public registry (hub.docker.com). So you can not see in the local registry of the process. If you also want to see the process in the local registry, you need to download registry mirroring, and load the image in a container run the job.

sudo mkdir /opt/data/registry -p

sudo docker run -d -p 5000:5000 -v /opt/data/registry:/tmp/registry registry:2

Screenshot (4) .png

Guess you like

Origin blog.51cto.com/14625168/2456970