zoukankan      html  css  js  c++  java
  • 5.Docker服务进程关系

    Docker服务进程关系

    宿主机进程关系

    注意:此图片适用于18.09.X版本;如果是18.06之前版本,containerd的父进程不再是systemd,而是dockerd;名字为docker-containe。

    containerd进程关系

    containerd进程关系
    dockerd 被client直接访问,其附近成为宿主机的systemd守护进程
    docker-proxy 实现容器通信,维护生成iptables规则,父进程为dockerd
    containerd 被dockerd进程调用以实现与runc交互
    containerd-shim 真正运行容器的载体,其父进程为containerd

    containerd-shim命令

    ~]# containerd-shim -h
    Usage of containerd-shim:
      -address string
        	grpc address back to main containerd
      -containerd-binary containerd publish
        	path to containerd binary (used for containerd publish) (default "containerd")
      -criu string
        	path to criu binary
      -debug
        	enable debug output in logs
      -namespace string
        	namespace that owns the shim
      -runtime-root string
        	root directory for the runtime (default "/run/containerd/runc")
      -socket string
        	abstract socket path to serve
      -systemd-cgroup
        	set runtime to use systemd-cgroup
      -workdir string
        	path used to storge large temporary data
    
    

    容器的创建于管理过程通信流程

    1. docker通过grpc和containerd模块通信(runc)交换,dockerd和containerd通信的socker文件:/run/containerd/containerd.sock
    2. containerd在dockerd启动时被启动,然后containerd启动grpc请求监听,containerd处理grpc请求,根据请求做相应动作。
    3. 若是创建容器,containerd拉起一个container-shim容器进程,并进行相应的创建操作。
    4. container-shim被拉起后,start/exec/create拉起runC进程,通过exit、control文件和containerd通信,通过父子进程关系和SIGCHLD(信号)监控容器中进程状态。
    5. 在整个容器生命周期中,containerd通过epoll监控容器文件,监控容器事件。

    grpc

    gRPC是Google开发的一块高性能、开源和通用的RPC框架,支持众多语言客户端

    https://www.grpc.io/

  • 相关阅读:
    不可或缺 Windows Native (15)
    不可或缺 Windows Native (14)
    不可或缺 Windows Native (13)
    不可或缺 Windows Native (12)
    不可或缺 Windows Native (11)
    不可或缺 Windows Native (10)
    不可或缺 Windows Native (9)
    不可或缺 Windows Native (8)
    不可或缺 Windows Native (7)
    不可或缺 Windows Native (6)
  • 原文地址:https://www.cnblogs.com/Gmiaomiao/p/13195186.html
Copyright © 2011-2022 走看看