由于文章核心内容并不是自己所写,只是搬运下。
        这类文章应该也是比较多,查询了解原作者想法,才是最原汁原味的理解各组件为什么这么设计?对于该软件的理解更深一些。

    1、docker containerd runc为啥不同
    https://medium.com/@alenkacz/whats-the-difference-between-runc-containerd-docker-3fc8f79d4d6e
  What’s not seem to be discussed that much is that with Docker 1.11 another separate component is containerd-shim. This is the parent process of every container started and it also allows daemon-less containers (so e.g. upgrading docker daemon without restarting all your containers, which was a big pain, yay!).
    2、这里提前开发者的视角讨论为什么要设计一个containerd-shim
    https://groups.google.com/forum/#!topic/docker-dev/zaZFlvIx1_k
  The shim allows for daemonless containers.  It basically sits as the parent of the container's process to facilitate a few things.  

First it allows the runtimes, i.e. runc,to exit after it starts the container. This way we don't have to have the long running runtime processes for containers. When you start mysql you should only see the mysql process and the shim.

Second it keeps the STDIO and other fds open for the container incase containerd and/or docker both die. If the shim was not running then the parent side of the pipes or the TTY master would be closed and the container would exit.

Finally it allows the container's exit status to be reported back to a higher level tool like docker without having the be the actual parent of the container's process and do a wait4.
I did a talk on this last week at dockercon US. You can see my slides here. https://github.com/crosbymichael/dockercon-2016

Hopefully that will explain a little more about how containerd and the shim work.

3、 查看开发者对于这块的分享
https://github.com/crosbymichael/dockercon-2016

containerd功能
● Fast, lightweight container supervisor
● runc (OCI) multiplexer
● Container lifecycle operations
为什么这么设计?
● runc integration
● Multiple runtime support
● Execution v2
● Decouple Execution from filesystem
● daemonless containers
● cleaner development

4、查看containerd项目设计文档,里面提及contained daemon进程只是提供api用于管理containers,containerd-shim管理container lifecycle 等
https://github.com/containerd/containerd/tree/master/design

https://github.com/containerd/containerd/blob/master/design/lifecycle.md
While containerd is a daemon that provides API to manage multiple containers, the containers themselves are not tied to the lifecycle of containerd. Each container has a shim that acts as the direct parent for the container's processes as well as reporting the exit status and holding onto the STDIO of the container. This also allows containerd to crash and restore all functionality to containers.

5、nnt 对于k8s runtime的及runc的用途
http://events19.linuxfoundation.org/wp-content/uploads/2017/11/How-Container-Runtime-Matters-in-Kubernetes_-OSS-Kunal-Kushwaha.pdf
docker组件_第1张图片
docker组件_第2张图片
docker组件_第3张图片
docker组件_第4张图片
docker组件_第5张图片
docker组件_第6张图片
docker组件_第7张图片

   6、docker daemon主件提供api,并通过containerd来进行对containers实现管理

     其他相关链接:
  cri-o :https://medium.com/cri-o/container-runtimes-clarity-342b62172dc3
  https://www.docker.com/blog/author/michael-crosby/
    https://github.com/crosbymichael
    https://twitter.com/thajeztah?lang=en
    https://www.mail-archive.com/[email protected]/mail3.html