K8s容器运行时,移除Dockershim后存在哪些疑惑?
<section id="nice" data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="margin: 0; padding: 0 10px; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; font-family: Optima, "Microsoft YaHei", PingFangSC-regular, serif; font-size: 16px; color: rgba(0, 0, 0, 1); line-height: 1.5em; word-spacing: 0; letter-spacing: 0; overflow-wrap: break-word; text-align: left"><h1 data-tool="mdnice编辑器" style="margin: 30px 0 15px; padding: 0; background: url("https://files.mdnice.com/koala-1.png") center / 75px no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; align-items: unset; border: 1px none rgba(0, 0, 0, 1); border-radius: 0; box-shadow: none; display: flex; flex-direction: unset; float: unset; justify-content: center; line-height: 1.5em; overflow-x: unset; overflow-y: unset; position: relative; text-align: left; text-shadow: none; transform: none; -webkit-box-reflect: unset"><span class="prefix" style="display: none"></span><span class="content" style="font-size: 18px; color: rgba(72, 179, 120, 1); line-height: 2.4em; letter-spacing: 0; margin: 38px 0 10px; border-top: 1px none rgba(0, 0, 0, 1); border-bottom: 2px solid rgba(46, 121, 80, 1); border-left: 1px none rgba(0, 0, 0, 1); border-right: 1px none rgba(0, 0, 0, 1); border-radius: 0; align-items: unset; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); box-shadow: none; display: inline-block; font-weight: bold; flex-direction: unset; float: unset; height: 38px; justify-content: unset; overflow-x: unset; overflow-y: unset; padding: 0; position: relative; text-align: center; text-indent: 0; text-shadow: none; transform: none; width: auto; -webkit-box-reflect: unset">K8s容器运行时,移除Dockershim后存在哪些疑惑?</span><span class="suffix" style="display: none"></span></h1><p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">大家好,我是秋意零。</p>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">K8s版本截止目前(24/09)已经发布到了1.31.x版本。早在K8s版本从1.24.x起(22/05),默认的容器运行时就不再是Docker了或者说Dockershim。</p>
<blockquote class="custom-blockquote multiquote-1" data-tool="mdnice编辑器" style="margin: 20px 0; padding: 10px 10px 10px 20px; border-top: 3px none rgba(0, 0, 0, 0.4); border-bottom: 3px none rgba(0, 0, 0, 0.4); border-left: 3px solid rgba(53, 179, 120, 1); border-right: 3px none rgba(0, 0, 0, 0.4); border-radius: 0; background: none left top / auto no-repeat scroll padding-box border-box rgba(251, 249, 253, 1); width: auto; height: auto; box-shadow: 0 0 rgba(0, 0, 0, 0); display: block; overflow-x: auto; overflow-y: auto"><span style="display: none; color: rgba(0, 0, 0, 1); font-size: 16px; line-height: 1.5em; letter-spacing: 0; text-align: left; font-weight: normal"></span>
<p style="text-indent: 0; padding: 16px 0 8px; color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; font-weight: normal; margin: 0">发行版本 | Kubernetes</p>
<p style="text-indent: 0; padding: 16px 0 8px; color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; font-weight: normal; margin: 0">Patch Releases | Kubernetes</p>
<figure style="margin: 10px 0; padding: 0; display: flex; flex-direction: column; justify-content: center; align-items: center"><img src="https://blog.images.qiuyl.com/blog_images/202409221601451.png"></figure>
</blockquote>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">最直接的原因,就是影响了性能。因为K8s调用Docker中Containerd容器运行时需要一个中间层Dockershim,造成了多余的性能和系统稳定性问题。具体是怎么个事呢,这里就来捋上一捋!同时介绍runc、ctr、crictl、nerdctl都是怎么个事!</p>
<blockquote class="custom-blockquote multiquote-1" data-tool="mdnice编辑器" style="margin: 20px 0; padding: 10px 10px 10px 20px; border-top: 3px none rgba(0, 0, 0, 0.4); border-bottom: 3px none rgba(0, 0, 0, 0.4); border-left: 3px solid rgba(53, 179, 120, 1); border-right: 3px none rgba(0, 0, 0, 0.4); border-radius: 0; background: none left top / auto no-repeat scroll padding-box border-box rgba(251, 249, 253, 1); width: auto; height: auto; box-shadow: 0 0 rgba(0, 0, 0, 0); display: block; overflow-x: auto; overflow-y: auto"><span style="display: none; color: rgba(0, 0, 0, 1); font-size: 16px; line-height: 1.5em; letter-spacing: 0; text-align: left; font-weight: normal"></span>
<p style="text-indent: 0; padding: 16px 0 8px; color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; font-weight: normal; margin: 0">内心OS:1.24第一版本早在22/05就发布了,距今已经过去2年多了。现在才来捋属实感觉有点晚了,不知有没有朋友和我一样一直没有捋明白呢😬!</p>
<p style="text-indent: 0; padding: 16px 0 8px; color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; font-weight: normal; margin: 0">如果是 那就接着往下看,有用点个赞、评论明白了😘!</p>
</blockquote>
<h2 data-tool="mdnice编辑器" style="margin: 30px 0 15px; padding: 0; background: url("https://files.mdnice.com/koala-2.png") center / 63px no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; align-items: unset; border: 1px none rgba(0, 0, 0, 1); border-radius: 0; box-shadow: none; display: flex; flex-direction: unset; float: unset; justify-content: center; line-height: 1.5em; overflow-x: unset; overflow-y: unset; position: relative; text-align: left; text-shadow: none; transform: none; -webkit-box-reflect: unset"><span class="prefix" style="display: none"></span><span class="content" style="font-size: 18px; color: rgba(72, 179, 120, 1); line-height: 2.4em; letter-spacing: 0; margin: 38px 0 10px; border: 1px none rgba(0, 0, 0, 1); border-radius: 0; align-items: unset; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); box-shadow: none; display: inline-block; font-weight: bold; flex-direction: unset; float: unset; height: 38px; justify-content: unset; overflow-x: unset; overflow-y: unset; padding: 0; position: relative; text-align: center; text-indent: 0; text-shadow: none; transform: none; width: auto; -webkit-box-reflect: unset">Containerd 简介</span><span class="suffix" style="display: none"></span></h2>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">官方解释:containerd 是一种行业标准的容器运行时,强调简单性、健壮性和可移植性。它可作为 Linux 和 Windows 的守护进程使用,可以管理其主机系统的完整容器生命周期:镜像传输和存储、容器执行和监督、底层存储和网络附件等。</p>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">一句话总结:Containerd 是一种<strong style="color: rgba(74, 74, 74, 1); font-weight: bold; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; margin: 0; padding: 0; border: 3px none rgba(0, 0, 0, 0.4); border-radius: 0">基于 CRI</strong> 的容器运行时,用于管理容器的生命周期。</p>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px"><strong style="color: rgba(74, 74, 74, 1); font-weight: bold; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; margin: 0; padding: 0; border: 3px none rgba(0, 0, 0, 0.4); border-radius: 0">PS:</strong></p>
<ul data-tool="mdnice编辑器" style="list-style-type: disc; margin: 8px 0; padding: 0 0 0 25px; color: rgba(0, 0, 0, 1)">
<li><section style="margin-top: 5px; margin-bottom: 5px; color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; font-weight: normal"><p style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">容器运行时:是负责运行容器的软件</p>
</section></li><li><section style="margin-top: 5px; margin-bottom: 5px; color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; font-weight: normal"><p style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">CRI:这个接口是 Kubernetes 与容器运行时交互的标准接口</p>
</section></li></ul>
<blockquote class="custom-blockquote multiquote-1" data-tool="mdnice编辑器" style="margin: 20px 0; padding: 10px 10px 10px 20px; border-top: 3px none rgba(0, 0, 0, 0.4); border-bottom: 3px none rgba(0, 0, 0, 0.4); border-left: 3px solid rgba(53, 179, 120, 1); border-right: 3px none rgba(0, 0, 0, 0.4); border-radius: 0; background: none left top / auto no-repeat scroll padding-box border-box rgba(251, 249, 253, 1); width: auto; height: auto; box-shadow: 0 0 rgba(0, 0, 0, 0); display: block; overflow-x: auto; overflow-y: auto"><span style="display: none; color: rgba(0, 0, 0, 1); font-size: 16px; line-height: 1.5em; letter-spacing: 0; text-align: left; font-weight: normal"></span>
<p style="text-indent: 0; padding: 16px 0 8px; color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; font-weight: normal; margin: 0">K8s架构理解:【探索 Kubernetes|容器基础进阶篇 系列 4】理解现代云原生时代的引擎</p>
</blockquote>
<h2 data-tool="mdnice编辑器" style="margin: 30px 0 15px; padding: 0; background: url("https://files.mdnice.com/koala-2.png") center / 63px no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; align-items: unset; border: 1px none rgba(0, 0, 0, 1); border-radius: 0; box-shadow: none; display: flex; flex-direction: unset; float: unset; justify-content: center; line-height: 1.5em; overflow-x: unset; overflow-y: unset; position: relative; text-align: left; text-shadow: none; transform: none; -webkit-box-reflect: unset"><span class="prefix" style="display: none"></span><span class="content" style="font-size: 18px; color: rgba(72, 179, 120, 1); line-height: 2.4em; letter-spacing: 0; margin: 38px 0 10px; border: 1px none rgba(0, 0, 0, 1); border-radius: 0; align-items: unset; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); box-shadow: none; display: inline-block; font-weight: bold; flex-direction: unset; float: unset; height: 38px; justify-content: unset; overflow-x: unset; overflow-y: unset; padding: 0; position: relative; text-align: center; text-indent: 0; text-shadow: none; transform: none; width: auto; -webkit-box-reflect: unset">捋上一捋</span><span class="suffix" style="display: none"></span></h2>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px"><strong style="color: rgba(74, 74, 74, 1); font-weight: bold; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; margin: 0; padding: 0; border: 3px none rgba(0, 0, 0, 0.4); border-radius: 0">1)为什么不继续使用Docker作为运行时</strong></p>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">Docker并不是一个“物件”,他是一个完整技术栈。它技术栈中有一个叫做 “containerd” 的部件本身,才是一个容器运行时。</p>
<blockquote class="custom-blockquote multiquote-1" data-tool="mdnice编辑器" style="margin: 20px 0; padding: 10px 10px 10px 20px; border-top: 3px none rgba(0, 0, 0, 0.4); border-bottom: 3px none rgba(0, 0, 0, 0.4); border-left: 3px solid rgba(53, 179, 120, 1); border-right: 3px none rgba(0, 0, 0, 0.4); border-radius: 0; background: none left top / auto no-repeat scroll padding-box border-box rgba(251, 249, 253, 1); width: auto; height: auto; box-shadow: 0 0 rgba(0, 0, 0, 0); display: block; overflow-x: auto; overflow-y: auto"><span style="display: none; color: rgba(0, 0, 0, 1); font-size: 16px; line-height: 1.5em; letter-spacing: 0; text-align: left; font-weight: normal"></span>
<p style="text-indent: 0; padding: 16px 0 8px; color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; font-weight: normal; margin: 0">执行<code style="color: rgba(40, 202, 113, 1); font-size: 14px; line-height: 1.8em; letter-spacing: 0; background: none left top / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05); width: auto; height: auto; margin: 0 2px; padding: 2px 4px; border-top: 3px none rgba(0, 0, 0, 1); border-bottom: 3px none rgba(0, 0, 0, 0.4); border-left: 3px none rgba(0, 0, 0, 0.4); border-right: 3px none rgba(0, 0, 0, 0.4); border-radius: 4px; overflow-wrap: break-word; font-family: "Operator Mono", Consolas, Monaco, Menlo, monospace; word-break: break-all">yum install docker-ce</code>,验证Docker是否包含Containerd,最简单的方式。</p>
<figure style="margin: 10px 0; padding: 0; display: flex; flex-direction: column; justify-content: center; align-items: center"><img src="https://blog.images.qiuyl.com/blog_images/202409221657188.png"></figure>
</blockquote>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">Docker 它提供了很多用户体验增强功能,而这简化了我们用户开发工作时的操作。然而 Kubernetes 用不到这些增强的用户体验,毕竟它并非人类。</p>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">因为这个用户友好的抽象层,Kubernetes 集群不得不引入一个叫做 Dockershim 的工具来访问它真正需要的 containerd。 这不是一件好事,因为这引入了额外的运维工作量,同时影响性能与稳定性,而且还可能出错。</p>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px"><strong style="color: rgba(74, 74, 74, 1); font-weight: bold; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; margin: 0; padding: 0; border: 3px none rgba(0, 0, 0, 0.4); border-radius: 0">2)为什么K8s不直接访问Docker中的Containerd组件,为什么需要Dockershim呢?</strong></p>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">Docker Engine 没有实现(CRI)接口,因此 Kubernetes 项目创建了特殊代码来帮助过渡, 并使 Dockershim 代码成为 Kubernetes 的一部分。Dockershim 代码一直是一个临时解决方案(因此得名:shim 垫片)。</p>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">如果 Docker 兼容 CRI,就不需要这个 Dockershim 了。</p>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px"><strong style="color: rgba(74, 74, 74, 1); font-weight: bold; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; margin: 0; padding: 0; border: 3px none rgba(0, 0, 0, 0.4); border-radius: 0">3)Docker构建/拉取的镜像,K8s还能使用嘛?</strong></p>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">Docker 构建的镜像并不是 Docker 特有的镜像,它是一个基于 OCI 的镜像。任一以 OCI 为标准构建的镜像,K8s都是可以使用的。</p>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px"><strong style="color: rgba(74, 74, 74, 1); font-weight: bold; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; margin: 0; padding: 0; border: 3px none rgba(0, 0, 0, 0.4); border-radius: 0">PS:</strong></p>
<ul data-tool="mdnice编辑器" style="list-style-type: disc; margin: 8px 0; padding: 0 0 0 25px; color: rgba(0, 0, 0, 1)">
<li><section style="margin-top: 5px; margin-bottom: 5px; color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; font-weight: normal">OCI:定义了容器运行时的规范和镜像格式规范</section></li></ul>
<blockquote class="custom-blockquote multiquote-1" data-tool="mdnice编辑器" style="margin: 20px 0; padding: 10px 10px 10px 20px; border-top: 3px none rgba(0, 0, 0, 0.4); border-bottom: 3px none rgba(0, 0, 0, 0.4); border-left: 3px solid rgba(53, 179, 120, 1); border-right: 3px none rgba(0, 0, 0, 0.4); border-radius: 0; background: none left top / auto no-repeat scroll padding-box border-box rgba(251, 249, 253, 1); width: auto; height: auto; box-shadow: 0 0 rgba(0, 0, 0, 0); display: block; overflow-x: auto; overflow-y: auto"><span style="display: none; color: rgba(0, 0, 0, 1); font-size: 16px; line-height: 1.5em; letter-spacing: 0; text-align: left; font-weight: normal"></span>
<p style="text-indent: 0; padding: 16px 0 8px; color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; font-weight: normal; margin: 0">K8s架构理解:【探索 Kubernetes|容器基础进阶篇 系列 4】理解现代云原生时代的引擎</p>
</blockquote>
<h2 data-tool="mdnice编辑器" style="margin: 30px 0 15px; padding: 0; background: url("https://files.mdnice.com/koala-2.png") center / 63px no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; align-items: unset; border: 1px none rgba(0, 0, 0, 1); border-radius: 0; box-shadow: none; display: flex; flex-direction: unset; float: unset; justify-content: center; line-height: 1.5em; overflow-x: unset; overflow-y: unset; position: relative; text-align: left; text-shadow: none; transform: none; -webkit-box-reflect: unset"><span class="prefix" style="display: none"></span><span class="content" style="font-size: 18px; color: rgba(72, 179, 120, 1); line-height: 2.4em; letter-spacing: 0; margin: 38px 0 10px; border: 1px none rgba(0, 0, 0, 1); border-radius: 0; align-items: unset; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); box-shadow: none; display: inline-block; font-weight: bold; flex-direction: unset; float: unset; height: 38px; justify-content: unset; overflow-x: unset; overflow-y: unset; padding: 0; position: relative; text-align: center; text-indent: 0; text-shadow: none; transform: none; width: auto; -webkit-box-reflect: unset">Containerd 与 runc 关系</span><span class="suffix" style="display: none"></span></h2>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">官方解释:<code style="color: rgba(40, 202, 113, 1); font-size: 14px; line-height: 1.8em; letter-spacing: 0; background: none left top / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05); width: auto; height: auto; margin: 0 2px; padding: 2px 4px; border-top: 3px none rgba(0, 0, 0, 1); border-bottom: 3px none rgba(0, 0, 0, 0.4); border-left: 3px none rgba(0, 0, 0, 0.4); border-right: 3px none rgba(0, 0, 0, 0.4); border-radius: 4px; overflow-wrap: break-word; font-family: "Operator Mono", Consolas, Monaco, Menlo, monospace; word-break: break-all">runc</code>是一个 CLI 工具,用于根据 OCI 规范在 Linux 上生成和运行容器。</p>
<blockquote class="custom-blockquote multiquote-1" data-tool="mdnice编辑器" style="margin: 20px 0; padding: 10px 10px 10px 20px; border-top: 3px none rgba(0, 0, 0, 0.4); border-bottom: 3px none rgba(0, 0, 0, 0.4); border-left: 3px solid rgba(53, 179, 120, 1); border-right: 3px none rgba(0, 0, 0, 0.4); border-radius: 0; background: none left top / auto no-repeat scroll padding-box border-box rgba(251, 249, 253, 1); width: auto; height: auto; box-shadow: 0 0 rgba(0, 0, 0, 0); display: block; overflow-x: auto; overflow-y: auto"><span style="display: none; color: rgba(0, 0, 0, 1); font-size: 16px; line-height: 1.5em; letter-spacing: 0; text-align: left; font-weight: normal"></span>
<p style="text-indent: 0; padding: 16px 0 8px; color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; font-weight: normal; margin: 0">GitHub - opencontainers/runc</p>
</blockquote>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px"><strong style="color: rgba(74, 74, 74, 1); font-weight: bold; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; margin: 0; padding: 0; border: 3px none rgba(0, 0, 0, 0.4); border-radius: 0">1)Containerd 与 runc 关系</strong></p>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">Containerd 的运行时要求非常低。与 Linux 和 Windows 容器功能集的大多数交互都是通过 runc 和特定于操作系统的库处理的。所有Containerd 依赖于 runc 来实现具体功能。</p>
<ul data-tool="mdnice编辑器" style="list-style-type: disc; margin: 8px 0; padding: 0 0 0 25px; color: rgba(0, 0, 0, 1)">
<li><section style="margin-top: 5px; margin-bottom: 5px; color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; font-weight: normal">runc 是一个<strong style="color: rgba(74, 74, 74, 1); font-weight: bold; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; margin: 0; padding: 0; border: 3px none rgba(0, 0, 0, 0.4); border-radius: 0">低级别的工具</strong>,用于创建、运行和管理容器的进程。它是容器运行时(container runtime)的一部分,主要用于执行容器内的应用程序。runc 实现了 OCI(Open Container Initiative)规范,允许开发者以标准化的方式创建和运行容器。</section></li><li><section style="margin-top: 5px; margin-bottom: 5px; color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; font-weight: normal">Containerd 是一个更高层次的容器管理系统,它负责管理容器的整个生命周期,包括容器的创建、启动、停止以及镜像的管理等。Containerd 提供了一个稳定、可插拔的架构,允许开发者以高度可定制的方式管理和编排容器。</section></li></ul>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px"><strong style="color: rgba(74, 74, 74, 1); font-weight: bold; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; margin: 0; padding: 0; border: 3px none rgba(0, 0, 0, 0.4); border-radius: 0">总结:</strong>Containerd 和 runc 之间的关系可以类比为主管与执行者的关系。Containerd 作为主管,负责高层次的管理工作,如容器和镜像的生命周期管理,而 runc 作为执行者,负责具体容器进程的创建和运行。</p>
<h2 data-tool="mdnice编辑器" style="margin: 30px 0 15px; padding: 0; background: url("https://files.mdnice.com/koala-2.png") center / 63px no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; align-items: unset; border: 1px none rgba(0, 0, 0, 1); border-radius: 0; box-shadow: none; display: flex; flex-direction: unset; float: unset; justify-content: center; line-height: 1.5em; overflow-x: unset; overflow-y: unset; position: relative; text-align: left; text-shadow: none; transform: none; -webkit-box-reflect: unset"><span class="prefix" style="display: none"></span><span class="content" style="font-size: 18px; color: rgba(72, 179, 120, 1); line-height: 2.4em; letter-spacing: 0; margin: 38px 0 10px; border: 1px none rgba(0, 0, 0, 1); border-radius: 0; align-items: unset; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); box-shadow: none; display: inline-block; font-weight: bold; flex-direction: unset; float: unset; height: 38px; justify-content: unset; overflow-x: unset; overflow-y: unset; padding: 0; position: relative; text-align: center; text-indent: 0; text-shadow: none; transform: none; width: auto; -webkit-box-reflect: unset">ctr、crictl、nerdctl 分不清?</span><span class="suffix" style="display: none"></span></h2>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">1)<code style="color: rgba(40, 202, 113, 1); font-size: 14px; line-height: 1.8em; letter-spacing: 0; background: none left top / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05); width: auto; height: auto; margin: 0 2px; padding: 2px 4px; border-top: 3px none rgba(0, 0, 0, 1); border-bottom: 3px none rgba(0, 0, 0, 0.4); border-left: 3px none rgba(0, 0, 0, 0.4); border-right: 3px none rgba(0, 0, 0, 0.4); border-radius: 4px; overflow-wrap: break-word; font-family: "Operator Mono", Consolas, Monaco, Menlo, monospace; word-break: break-all">ctr</code> 是 containerd 的原生自带命令行客户端工具,主要用于与 containerd 进行低级别的交互。它提供了对 containerd 的全面管理能力,包括镜像管理、容器管理、沙箱管理等。</p>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">2)<code style="color: rgba(40, 202, 113, 1); font-size: 14px; line-height: 1.8em; letter-spacing: 0; background: none left top / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05); width: auto; height: auto; margin: 0 2px; padding: 2px 4px; border-top: 3px none rgba(0, 0, 0, 1); border-bottom: 3px none rgba(0, 0, 0, 0.4); border-left: 3px none rgba(0, 0, 0, 0.4); border-right: 3px none rgba(0, 0, 0, 0.4); border-radius: 4px; overflow-wrap: break-word; font-family: "Operator Mono", Consolas, Monaco, Menlo, monospace; word-break: break-all">crictl</code> 是 Kubernetes Container Runtime Interface (CRI) 的客户端工具,用于与实现了 CRI 接口的容器运行时(如 containerd 或 Docker)进行交互。它提供了类似于 <code style="color: rgba(40, 202, 113, 1); font-size: 14px; line-height: 1.8em; letter-spacing: 0; background: none left top / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05); width: auto; height: auto; margin: 0 2px; padding: 2px 4px; border-top: 3px none rgba(0, 0, 0, 1); border-bottom: 3px none rgba(0, 0, 0, 0.4); border-left: 3px none rgba(0, 0, 0, 0.4); border-right: 3px none rgba(0, 0, 0, 0.4); border-radius: 4px; overflow-wrap: break-word; font-family: "Operator Mono", Consolas, Monaco, Menlo, monospace; word-break: break-all">docker</code> 命令的高级功能,使得用户可以方便地管理容器和镜像。</p>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">3)<code style="color: rgba(40, 202, 113, 1); font-size: 14px; line-height: 1.8em; letter-spacing: 0; background: none left top / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05); width: auto; height: auto; margin: 0 2px; padding: 2px 4px; border-top: 3px none rgba(0, 0, 0, 1); border-bottom: 3px none rgba(0, 0, 0, 0.4); border-left: 3px none rgba(0, 0, 0, 0.4); border-right: 3px none rgba(0, 0, 0, 0.4); border-radius: 4px; overflow-wrap: break-word; font-family: "Operator Mono", Consolas, Monaco, Menlo, monospace; word-break: break-all">nerdctl</code> 是 containerd 的另一个命令行工具,它的设计目标是提供一个与 <code style="color: rgba(40, 202, 113, 1); font-size: 14px; line-height: 1.8em; letter-spacing: 0; background: none left top / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05); width: auto; height: auto; margin: 0 2px; padding: 2px 4px; border-top: 3px none rgba(0, 0, 0, 1); border-bottom: 3px none rgba(0, 0, 0, 0.4); border-left: 3px none rgba(0, 0, 0, 0.4); border-right: 3px none rgba(0, 0, 0, 0.4); border-radius: 4px; overflow-wrap: break-word; font-family: "Operator Mono", Consolas, Monaco, Menlo, monospace; word-break: break-all">docker</code> 命令相似的体验,使得用户可以无缝地从 Docker 迁移到 containerd。<code style="color: rgba(40, 202, 113, 1); font-size: 14px; line-height: 1.8em; letter-spacing: 0; background: none left top / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05); width: auto; height: auto; margin: 0 2px; padding: 2px 4px; border-top: 3px none rgba(0, 0, 0, 1); border-bottom: 3px none rgba(0, 0, 0, 0.4); border-left: 3px none rgba(0, 0, 0, 0.4); border-right: 3px none rgba(0, 0, 0, 0.4); border-radius: 4px; overflow-wrap: break-word; font-family: "Operator Mono", Consolas, Monaco, Menlo, monospace; word-break: break-all">nerdctl</code> 提供了许多与 <code style="color: rgba(40, 202, 113, 1); font-size: 14px; line-height: 1.8em; letter-spacing: 0; background: none left top / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05); width: auto; height: auto; margin: 0 2px; padding: 2px 4px; border-top: 3px none rgba(0, 0, 0, 1); border-bottom: 3px none rgba(0, 0, 0, 0.4); border-left: 3px none rgba(0, 0, 0, 0.4); border-right: 3px none rgba(0, 0, 0, 0.4); border-radius: 4px; overflow-wrap: break-word; font-family: "Operator Mono", Consolas, Monaco, Menlo, monospace; word-break: break-all">docker</code> 命令相同的子命令,使得迁移更加简便。但只支持 containerd 容器运行时。</p>
<h3 data-tool="mdnice编辑器" style="margin: 30px 0 15px; padding: 0; align-items: unset; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); border: 1px none rgba(0, 0, 0, 1); border-radius: 0; box-shadow: none; display: block; flex-direction: unset; float: unset; height: auto; justify-content: unset; line-height: 1.5em; overflow-x: unset; overflow-y: unset; position: relative; text-align: left; text-shadow: none; transform: none; width: auto; -webkit-box-reflect: unset"><span style="background: url("https://files.mdnice.com/koala-3.png") left top / 15px 15px no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: 15px; height: 15px; align-items: unset; border: 1px none rgba(0, 0, 0, 1); border-radius: 0; box-shadow: none; color: rgba(0, 0, 0, 1); display: inline-block; font-size: 22px; font-weight: bold; flex-direction: unset; float: unset; justify-content: unset; letter-spacing: 0; line-height: 1.5em; margin: 0 0 -2px; overflow-x: unset; overflow-y: unset; padding: 0; position: relative; text-align: left; text-indent: 0; text-shadow: none; transform: none; -webkit-box-reflect: unset"></span><span class="prefix" style="display: none"></span><span class="content" style="font-size: 16px; color: rgba(72, 179, 120, 1); line-height: 1.5em; letter-spacing: 0; align-items: unset; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); border: 1px none rgba(0, 0, 0, 1); border-radius: 0; box-shadow: none; display: inline-block; font-weight: bold; flex-direction: unset; float: unset; height: auto; justify-content: unset; margin: 0 0 0 8px; overflow-x: unset; overflow-y: unset; padding: 0; position: relative; text-align: left; text-indent: 0; text-shadow: none; transform: none; width: auto; -webkit-box-reflect: unset">常用操作指令</span><span class="suffix" style="display: none"></span></h3>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">Containerd容器运行时,存在NameSpace的概念。创建好K8s集群后Containerd中存在两个名称空间default与k8s.io</p>
<blockquote class="custom-blockquote multiquote-1" data-tool="mdnice编辑器" style="margin: 20px 0; padding: 10px 10px 10px 20px; border-top: 3px none rgba(0, 0, 0, 0.4); border-bottom: 3px none rgba(0, 0, 0, 0.4); border-left: 3px solid rgba(53, 179, 120, 1); border-right: 3px none rgba(0, 0, 0, 0.4); border-radius: 0; background: none left top / auto no-repeat scroll padding-box border-box rgba(251, 249, 253, 1); width: auto; height: auto; box-shadow: 0 0 rgba(0, 0, 0, 0); display: block; overflow-x: auto; overflow-y: auto"><span style="display: none; color: rgba(0, 0, 0, 1); font-size: 16px; line-height: 1.5em; letter-spacing: 0; text-align: left; font-weight: normal"></span>
<p style="text-indent: 0; padding: 16px 0 8px; color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; font-weight: normal; margin: 0">NameSpace就好比,Windows系统中的文件夹,每个NameSpace内容相互隔离。</p>
<p style="text-indent: 0; padding: 16px 0 8px; color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; font-weight: normal; margin: 0"><strong style="color: rgba(74, 74, 74, 1); font-weight: bold; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; margin: 0; padding: 0; border: 3px none rgba(0, 0, 0, 0.4); border-radius: 0">注意</strong>:与K8s的名称空间类似,不过不要搞混了。K8s名称空间是隔离资源,Containerd名称空间是隔离镜像。</p>
</blockquote>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px"><strong style="color: rgba(74, 74, 74, 1); font-weight: bold; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; margin: 0; padding: 0; border: 3px none rgba(0, 0, 0, 0.4); border-radius: 0">ctr、crictl、nerdctl</strong></p>
<ol data-tool="mdnice编辑器" style="list-style-type: decimal; margin: 8px 0; padding: 0 0 0 25px; color: rgba(0, 0, 0, 1)">
<li><section style="margin-top: 5px; margin-bottom: 5px; color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; font-weight: normal"><p style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">ctr 默认采用 default 名称空间</p>
<blockquote class="custom-blockquote multiquote-1" style="margin: 20px 0; padding: 10px 10px 10px 20px; border-top: 3px none rgba(0, 0, 0, 0.4); border-bottom: 3px none rgba(0, 0, 0, 0.4); border-left: 3px solid rgba(53, 179, 120, 1); border-right: 3px none rgba(0, 0, 0, 0.4); border-radius: 0; background: none left top / auto no-repeat scroll padding-box border-box rgba(251, 249, 253, 1); width: auto; height: auto; box-shadow: 0 0 rgba(0, 0, 0, 0); display: block; overflow-x: auto; overflow-y: auto"><span style="display: none; color: rgba(0, 0, 0, 1); font-size: 16px; line-height: 1.5em; letter-spacing: 0; text-align: left; font-weight: normal"></span>
<p style="text-indent: 0; padding: 16px 0 8px; color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; font-weight: normal; margin: 0">切换名称空间:-n参数选择不同的名称空间<code style="color: rgba(40, 202, 113, 1); font-size: 14px; line-height: 1.8em; letter-spacing: 0; height: auto; background: none left top / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05); width: auto; margin: 0 2px; padding: 2px 4px; border-top: 3px none rgba(0, 0, 0, 1); border-bottom: 3px none rgba(0, 0, 0, 0.4); border-left: 3px none rgba(0, 0, 0, 0.4); border-right: 3px none rgba(0, 0, 0, 0.4); border-radius: 4px; overflow-wrap: break-word; font-family: "Operator Mono", Consolas, Monaco, Menlo, monospace; word-break: break-all">ctr -n k8s.io images ls</code></p>
</blockquote>
</section></li><li><section style="margin-top: 5px; margin-bottom: 5px; color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; font-weight: normal"><p style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">crictl 默认采用 k8s.io 名称空间</p>
</section></li><li><section style="margin-top: 5px; margin-bottom: 5px; color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; font-weight: normal"><p style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">nerdctl 默认采用 default 名称空间</p>
<blockquote class="custom-blockquote multiquote-1" style="margin: 20px 0; padding: 10px 10px 10px 20px; border-top: 3px none rgba(0, 0, 0, 0.4); border-bottom: 3px none rgba(0, 0, 0, 0.4); border-left: 3px solid rgba(53, 179, 120, 1); border-right: 3px none rgba(0, 0, 0, 0.4); border-radius: 0; background: none left top / auto no-repeat scroll padding-box border-box rgba(251, 249, 253, 1); width: auto; height: auto; box-shadow: 0 0 rgba(0, 0, 0, 0); display: block; overflow-x: auto; overflow-y: auto"><span style="display: none; color: rgba(0, 0, 0, 1); font-size: 16px; line-height: 1.5em; letter-spacing: 0; text-align: left; font-weight: normal"></span>
<p style="text-indent: 0; padding: 16px 0 8px; color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; font-weight: normal; margin: 0">切换名称空间:在 /etc/nerdctl/nerdctl.toml 中添加或修改配置 <code style="color: rgba(40, 202, 113, 1); font-size: 14px; line-height: 1.8em; letter-spacing: 0; height: auto; background: none left top / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05); width: auto; margin: 0 2px; padding: 2px 4px; border-top: 3px none rgba(0, 0, 0, 1); border-bottom: 3px none rgba(0, 0, 0, 0.4); border-left: 3px none rgba(0, 0, 0, 0.4); border-right: 3px none rgba(0, 0, 0, 0.4); border-radius: 4px; overflow-wrap: break-word; font-family: "Operator Mono", Consolas, Monaco, Menlo, monospace; word-break: break-all">namespace = "k8s.io"</code></p>
</blockquote>
</section></li></ol>
<h4 data-tool="mdnice编辑器" style="margin: 30px 0 15px; padding: 0; display: block"><span class="prefix" style="display: none"></span><span class="content" style="font-size: 18px; color: rgba(0, 0, 0, 1); line-height: 1.5em; letter-spacing: 0; text-align: left; font-weight: bold; display: block"><strong style="color: rgba(74, 74, 74, 1); font-weight: bold; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; margin: 0; padding: 0; border: 3px none rgba(0, 0, 0, 0.4); border-radius: 0">1)Ctr(不常用,可忽略,了解即可)</strong></span><span class="suffix" style="display: none"></span></h4>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">镜像管理</p>
<pre class="custom" data-tool="mdnice编辑器" style="border-radius: 5px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.55); text-align: left; margin: 10px 0; padding: 0"><span style="display: block; background: url("https://files.mdnice.com/user/3441/876cad08-0422-409d-bb5a-08afec5da8ee.svg") 10px 10px / 40px no-repeat rgba(40, 44, 52, 1); height: 30px; width: 100%; margin-bottom: -7px; border-radius: 5px"></span><code class="hljs" style="overflow-x: auto; padding: 15px 16px 16px; color: rgba(171, 178, 191, 1); background: rgba(40, 44, 52, 1); border-radius: 5px; font-family: Consolas, Monaco, Menlo, monospace; font-size: 12px">1. 查看镜像<br>ctr images ls <span class="hljs-comment" style="color: rgba(92, 99, 112, 1); font-style: italic; line-height: 26px"># images可以简写为i。如:ctr i ls </span><br>查看指定名称空间镜像<br>ctr -nk8s.io images ls<br>2. 下载镜像<br>ctr image pull <镜像名称><br>3. 删除镜像<br>ctr image rm <镜像名称><br>4. 镜像导出<br>ctr i <span class="hljs-built_in" style="color: rgba(230, 192, 123, 1); line-height: 26px">export</span> <导出名称> <需要导出的源镜像名称><br>5. 镜像导入<br>ctr i import <镜像被导出时的镜像名称><br>6. 修改tag<br>ctr images tag <源镜像名称> <><br>7. 查看名称空间<br>ctr ns ls<br></code></pre>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">容器管理</p>
<pre class="custom" data-tool="mdnice编辑器" style="border-radius: 5px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.55); text-align: left; margin: 10px 0; padding: 0"><span style="display: block; background: url("https://files.mdnice.com/user/3441/876cad08-0422-409d-bb5a-08afec5da8ee.svg") 10px 10px / 40px no-repeat rgba(40, 44, 52, 1); height: 30px; width: 100%; margin-bottom: -7px; border-radius: 5px"></span><code class="hljs" style="overflow-x: auto; padding: 15px 16px 16px; color: rgba(171, 178, 191, 1); background: rgba(40, 44, 52, 1); border-radius: 5px; font-family: Consolas, Monaco, Menlo, monospace; font-size: 12px">1. 查看运行的容器<br>ctr container ls <span class="hljs-comment" style="color: rgba(92, 99, 112, 1); font-style: italic; line-height: 26px"># container可以简写为c。如:ctr c ls </span><br>2. 创建容器<br>ctr container create <镜像名称> <容器名称><br>3. 查看容器中跑的进程<br>ctr task ls<br>4. 停止容器<br>ctr tasks <span class="hljs-built_in" style="color: rgba(230, 192, 123, 1); line-height: 26px">kill</span> <容器名称><br>5. 删除容器<br>ctr tasks delete <容器名称><br></code></pre>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">crictl、nerdctl常用指令,就不列出来,网上可以找到很多。</p>
<h4 data-tool="mdnice编辑器" style="margin: 30px 0 15px; padding: 0; display: block"><span class="prefix" style="display: none"></span><span class="content" style="font-size: 18px; color: rgba(0, 0, 0, 1); line-height: 1.5em; letter-spacing: 0; text-align: left; font-weight: bold; display: block">2)crictl</span><span class="suffix" style="display: none"></span></h4>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">crictl 常见的命令大全 (aliyun.com)</p>
<h4 data-tool="mdnice编辑器" style="margin: 30px 0 15px; padding: 0; display: block"><span class="prefix" style="display: none"></span><span class="content" style="font-size: 18px; color: rgba(0, 0, 0, 1); line-height: 1.5em; letter-spacing: 0; text-align: left; font-weight: bold; display: block">3)nerdctl</span><span class="suffix" style="display: none"></span></h4>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">简单的nerdctl命令使用,操作手册-CSDN博客</p>
<h1 data-tool="mdnice编辑器" style="margin: 30px 0 15px; padding: 0; background: url("https://files.mdnice.com/koala-1.png") center / 75px no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; align-items: unset; border: 1px none rgba(0, 0, 0, 1); border-radius: 0; box-shadow: none; display: flex; flex-direction: unset; float: unset; justify-content: center; line-height: 1.5em; overflow-x: unset; overflow-y: unset; position: relative; text-align: left; text-shadow: none; transform: none; -webkit-box-reflect: unset"><span class="prefix" style="display: none"></span><span class="content" style="font-size: 18px; color: rgba(72, 179, 120, 1); line-height: 2.4em; letter-spacing: 0; margin: 38px 0 10px; border-top: 1px none rgba(0, 0, 0, 1); border-bottom: 2px solid rgba(46, 121, 80, 1); border-left: 1px none rgba(0, 0, 0, 1); border-right: 1px none rgba(0, 0, 0, 1); border-radius: 0; align-items: unset; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); box-shadow: none; display: inline-block; font-weight: bold; flex-direction: unset; float: unset; height: 38px; justify-content: unset; overflow-x: unset; overflow-y: unset; padding: 0; position: relative; text-align: center; text-indent: 0; text-shadow: none; transform: none; width: auto; -webkit-box-reflect: unset">参考</span><span class="suffix" style="display: none"></span></h1>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">容器运行时 | Kubernetes</p>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">GitHub - containerd/containerd:开放可靠的容器运行时</p>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">更新:移除 Dockershim 的常见问题 | Kubernetes</p>
<p data-tool="mdnice编辑器" style="color: rgba(63, 63, 63, 1); font-size: 16px; line-height: 1.8em; letter-spacing: 0.02em; text-align: left; text-indent: 0; margin: 0; padding: 16px 0 8px">别慌: Kubernetes 和 Docker | Kubernetes</p>
<h1 data-tool="mdnice编辑器" style="margin: 30px 0 15px; padding: 0; background: url("https://files.mdnice.com/koala-1.png") center / 75px no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; align-items: unset; border: 1px none rgba(0, 0, 0, 1); border-radius: 0; box-shadow: none; display: flex; flex-direction: unset; float: unset; justify-content: center; line-height: 1.5em; overflow-x: unset; overflow-y: unset; position: relative; text-align: left; text-shadow: none; transform: none; -webkit-box-reflect: unset"><span class="prefix" style="display: none"></span><span class="content" style="font-size: 18px; color: rgba(72, 179, 120, 1); line-height: 2.4em; letter-spacing: 0; margin: 38px 0 10px; border-top: 1px none rgba(0, 0, 0, 1); border-bottom: 2px solid rgba(46, 121, 80, 1); border-left: 1px none rgba(0, 0, 0, 1); border-right: 1px none rgba(0, 0, 0, 1); border-radius: 0; align-items: unset; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); box-shadow: none; display: inline-block; font-weight: bold; flex-direction: unset; float: unset; height: 38px; justify-content: unset; overflow-x: unset; overflow-y: unset; padding: 0; position: relative; text-align: center; text-indent: 0; text-shadow: none; transform: none; width: auto; -webkit-box-reflect: unset">End</span><span class="suffix" style="display: none"></span></h1>
</section><br><br>
来源:https://www.cnblogs.com/yetechlog/p/18843766
頁:
[1]