{"id":14815,"date":"2023-09-13T14:14:52","date_gmt":"2023-09-13T06:14:52","guid":{"rendered":"https:\/\/blog.ywdevops.cn\/?p=14815"},"modified":"2023-09-20T15:36:30","modified_gmt":"2023-09-20T07:36:30","slug":"containerd","status":"publish","type":"post","link":"https:\/\/blog.ywdevops.cn\/index.php\/2023\/09\/13\/containerd\/","title":{"rendered":"\u5bb9\u5668\u8fd0\u884c\u65f6containerd"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">containerd \u662f\u4e00\u4e2a\u5de5\u4e1a\u7ea7\u6807\u51c6\u7684\u5bb9\u5668\u8fd0\u884c\u65f6\uff0c\u5b83\u5f3a\u8c03<strong>\u7b80\u5355\u6027<\/strong>\u3001<strong>\u5065\u58ee\u6027<\/strong>\u548c<strong>\u53ef\u79fb\u690d\u6027<\/strong>\uff0c\u5728Linux\u548cwindow\u4e0a\u53ef\u4ee5\u4f5c\u4e3a\u4e00\u4e2a\u5b88\u62a4\u8fdb\u7a0b\u8fd0\u884c\uff0c\u5b83\u53ef\u4ee5\u7ba1\u7406\u4e3b\u673a\u7cfb\u7edf\u4e0a\u5bb9\u5668\u7684\u5b8c\u6574\u7684\u751f\u547d\u5468\u671f\uff1a\u955c\u50cf\u4f20\u8f93\u548c\u5b58\u50a8\uff0c\u5bb9\u5668\u7684\u6267\u884c\u548c\u76d1\u63a7\uff0c\u4f4e\u7ea7\u522b\u7684\u5b58\u50a8\u548c\u7f51\u7edc<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">containerd\u4f5c\u7528\u5982\u4e0b\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u7ba1\u7406\u5bb9\u5668\u7684\u751f\u547d\u5468\u671f(\u4ece\u521b\u5efa\u5bb9\u5668\u5230\u9500\u6bc1\u5bb9\u5668)<\/li>\n\n\n\n<li>\u62c9\u53d6\/\u63a8\u9001\u5bb9\u5668\u955c\u50cf<\/li>\n\n\n\n<li>\u5b58\u50a8\u7ba1\u7406(\u7ba1\u7406\u955c\u50cf\u53ca\u5bb9\u5668\u6570\u636e\u7684\u5b58\u50a8)<\/li>\n\n\n\n<li>\u8c03\u7528 runC \u8fd0\u884c\u5bb9\u5668(\u4e0e runC \u7b49\u5bb9\u5668\u8fd0\u884c\u65f6\u4ea4\u4e92)<\/li>\n\n\n\n<li>\u7ba1\u7406\u5bb9\u5668\u7f51\u7edc\u63a5\u53e3\u53ca\u7f51\u7edc<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">containerd\u7279\u70b9\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u7b80\u6d01\u7684\u57fa\u4e8e gRPC \u7684 API \u548c client library<\/li>\n\n\n\n<li>\u5b8c\u6574\u7684 OCI \u652f\u6301(runtime \u548c image spec)<\/li>\n\n\n\n<li>\u540c\u65f6\u5177\u5907\u7a33\u5b9a\u6027\u548c\u9ad8\u6027\u80fd\u7684\u5b9a\u4e49\u826f\u597d\u7684\u5bb9\u5668\u6838\u5fc3\u529f\u80fd<\/li>\n\n\n\n<li>\u4e00\u4e2a\u89e3\u8026\u7684\u7cfb\u7edf(\u8ba9 image\u3001filesystem\u3001runtime \u89e3\u8026\u5408)\uff0c\u5b9e\u73b0\u63d2\u4ef6\u5f0f\u7684\u6269\u5c55\u548c\u91cd\u7528<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">containerd\u67b6\u6784\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Containerd \u91c7\u7528\u6807\u51c6\u7684 C\/S \u67b6\u6784\uff1a\u670d\u52a1\u7aef\u901a\u8fc7 GRPC \u534f\u8bae\u63d0\u4f9b\u7a33\u5b9a\u7684 API\uff1b\u5ba2\u6237\u7aef\u901a\u8fc7\u8c03\u7528\u670d\u52a1\u7aef\u7684 API \u8fdb\u884c\u9ad8\u7ea7\u7684\u64cd\u4f5c<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u67b6\u6784\u56fe\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"621\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/5-5-1024x621.png\" alt=\"\" class=\"wp-image-14819\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/5-5-1024x621.png 1024w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/5-5-300x182.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/5-5-768x465.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/5-5-1536x931.png 1536w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/5-5-600x364.png 600w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/5-5.png 1782w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center wp-block-paragraph\"><strong>containerd\u5b89\u88c5<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u8f7d\u5730\u5740\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u5b98\u7f51\uff1a  https:\/\/containerd.io\/downloads\/\ngithub: https:\/\/github.com\/containerd\/containerd<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u89e3\u538b\u7f29\u5e76\u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf\u4e2d\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tar xf containerd-1.7.5-linux-amd64.tar.gz -C \/usr\/local<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u4e0b\u8f7d\u670d\u52a1\u6258\u7ba1\u6587\u4ef6\uff0c\u6839\u636e\u9700\u8981\u4fee\u6539\u5b9e\u9645\u7684container\u5730\u5740\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/raw.githubusercontent.com\/containerd\/containerd\/main\/containerd.service\nmv containerd.service \/lib\/systemd\/system  #\u653e\u5230\u670d\u52a1\u6258\u7ba1\u76ee\u5f55<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u91cd\u8f7d\u914d\u7f6e\u6587\u4ef6\u5e76\u8bbe\u7f6e\u5f00\u673a\u542f\u52a8\u5e76\u542f\u52a8\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl daemon-reload\nsystemctl enable --now containerd<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">4\u3001\u67e5\u770bcontainerd\u7684\u72b6\u6001\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"252\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/6-4.png\" alt=\"\" class=\"wp-image-14823\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/6-4.png 700w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/6-4-300x108.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/6-4-600x216.png 600w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center wp-block-paragraph\"><strong>runc\u5b89\u88c5<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u4e0b\u8f7drunc\uff0c\u4e0b\u8f7d\u5730\u5740\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;github.com\/opencontainers\/runc\/releases<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u6267\u884c\u5982\u4e0b\u547d\u4ee4\u5b89\u88c5\u5230\/usr\/local\/bin\/\u76ee\u5f55\u4e0b\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>install -m 755 runc.amd64 \/usr\/local\/sbin\/runc<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"240\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/7-4.png\" alt=\"\" class=\"wp-image-14826\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/7-4.png 700w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/7-4-300x103.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/7-4-600x206.png 600w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u8fd0\u884c\u547d\u4ee4\u67e5\u770brunc\u662f\u5426\u5b89\u88c5\u6210\u529f\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"699\" height=\"168\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/8-2.png\" alt=\"\" class=\"wp-image-14827\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/8-2.png 699w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/8-2-300x72.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/8-2-600x144.png 600w\" sizes=\"auto, (max-width: 699px) 100vw, 699px\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center wp-block-paragraph\"><strong>\u5b89\u88c5CNI\u63d2\u4ef6<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u4e0b\u8f7d\u5730\u5740\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;github.com\/containernetworking\/plugins\/releases<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u521b\u5efa\u76ee\u5f55\uff0c\u89e3\u538b\u4e8c\u8fdb\u5236\u6587\u4ef6\u5230\u76ee\u5f55\u4e0b\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir -p \/opt\/cni\/bin\ntar -xf cni-plugins-linux-amd64-v1.3.0.tgz -C \/opt\/cni\/bin<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e3a\u4ec0\u4e48\u8981\u5b89\u88c5\u5728\/opt\/cni\/bin\/\u4e0b\u9762\u5462\uff1f<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u56e0\u4e3acontainerd\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u8bfb\u53d6\u7684\u5c31\u662f\u6b64\u76ee\u5f55\u4e0b\u7684cni\u63d2\u4ef6\uff0ccontainerd\u8fd0\u884c\u540e\uff0c\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u914d\u7f6e\u6587\u4ef6\uff0c\u4f1a\u6709\u4e00\u4e2a\u9ed8\u8ba4\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u53ea\u662f\u5728\u673a\u5668\u4e0a\u770b\u4e0d\u5230\uff0c\u5982\u679c\u6211\u4eec\u9700\u8981\u4fee\u6539\u6b64\u914d\u7f6e\u6587\u4ef6\uff0c\u9700\u8981\u5148\u5c06\u9ed8\u8ba4\u914d\u7f6e\u6587\u4ef6\u751f\u6210\u51fa\u6765\uff0c\u53ef\u6267\u884c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>containerd config default &gt; \/etc\/containerd\/config.toml #\u6ce8\u610f\u8981\u653e\u5728\/etc\/containerd\u4e0b<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4fee\u6539\u6b64\u6587\u4ef6\u5373\u53ef\u6dfb\u52a0\u955c\u50cf\u52a0\u901f\u5668\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors]\n  &#91;plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors.\"docker.io\"]\r\n      endpoint = &#91;\"registry.aliyuncs.com\/google_containers\"]\r\n  &#91;plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors.\"k8s.gcr.io\"]\r\n      endpoint = &#91;\"registry.aliyuncs.com\/google_containers\"]<\/code><\/pre>\n\n\n\n<p class=\"has-text-align-center wp-block-paragraph\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">\u4f7f\u7528ctr\u547d\u4ee4<\/mark><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u62c9\u53d6\u955c\u50cf\uff0c\u6267\u884c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ctr images pull --platform linux\/amd64 docker.io\/library\/nginx:latest<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&#8211;platform\uff1a\u6307\u5b9a\u67b6\u6784\u5e73\u53f0\uff0c\u5982\u679c\u6709\u591a\u4e2a\u7528\u9017\u53f7\u5206\u9694\uff0c\u5982\uff1a&#8211;platform a,b,c<\/li>\n\n\n\n<li>docker.io\/library\uff1adocker hub \u4ed3\u5e93\u5730\u5740<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u7ed9\u955c\u50cf\u6253\u4e2atag\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ctr images tag docker.io\/library\/nginx:latest nginx:latest<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u67e5\u770b\u955c\u50cf\u5217\u8868\uff0cctr images ls \u547d\u4ee4\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ctr images ls  \u6216\u8005  ctr i ls<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"698\" height=\"177\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/9-2.png\" alt=\"\" class=\"wp-image-14831\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/9-2.png 698w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/9-2-300x76.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/9-2-600x152.png 600w\" sizes=\"auto, (max-width: 698px) 100vw, 698px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">4\u3001\u521b\u5efa\u5bb9\u5668\uff0c\u6267\u884c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ctr run -d --net-host nginx:latest nginx  #\u9ed8\u8ba4\u4f7f\u752880\u7aef\u53e3\uff0c\u4e3b\u673a\u4e5f\u4e00\u6837<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">5\u3001\u67e5\u770b\u521b\u5efa\u540e\u7684\u5bb9\u5668\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ctr containers ls \u6216\u8005 ctr c ls<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"117\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/10.png\" alt=\"\" class=\"wp-image-14836\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/10.png 700w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/10-300x50.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/10-600x100.png 600w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">6\u3001\u8fdb\u5165\u5230\u5bb9\u5668\u4e2d\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ctr task exec --exec-id $RANDOM -t nginx bash  #bash\u6216\u8005sh\u90fd\u53ef\u4ee5<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>$RANDOM\uff1a\u7279\u6b8a\u7684\u73af\u5883\u53d8\u91cf\uff0c\u7528\u4e8e\u751f\u6210\u968f\u673a\u6570\uff0c<code>--exec-id<\/code> \u53c2\u6570\u7528\u4e8e\u6307\u5b9a\u5728\u5bb9\u5668\u5185\u6267\u884c\u7684\u8fdb\u7a0b\u7684\u6807\u8bc6\u7b26\u3002\u901a\u8fc7\u5c06 <code>$RANDOM<\/code> \u4f5c\u4e3a <code>--exec-id<\/code> \u7684\u503c\uff0c\u53ef\u4ee5\u4fdd\u8bc1\u6bcf\u6b21\u6267\u884c\u547d\u4ee4\u65f6\u90fd\u4f1a\u751f\u6210\u4e00\u4e2a\u4e0d\u540c\u7684\u968f\u673a\u6807\u8bc6\u7b26\uff0c\u907f\u514d\u51b2\u7a81\u548c\u91cd\u590d<\/li>\n\n\n\n<li>-t\uff1a\u8868\u793a\u6307\u5b9a\u4e00\u4e2a\u7ec8\u7aef<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">7\u3001\u67e5\u770b\u5bb9\u5668\u8be6\u7ec6\u4fe1\u606f\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ctr container info nginx \u6216\u8005  ctr c info nginx # c \u662fcontainer\u7684\u7b80\u5199<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">8\u3001\u5220\u9664\u5bb9\u5668\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ctr task kill nginx    #\u6740\u6b7b\u5bb9\u5668\nctr task ls            #\u67e5\u770b\u5bb9\u5668\u72b6\u6001\nctr task rm nginx      #\u5220\u9664\u5bb9\u5668<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u66f4\u591a\u7528\u6cd5\u53ef\u4f7f\u7528ctr -h\u67e5\u8be2\u6216\u7f51\u4e0a\u641c\u7d22<\/p>\n\n\n\n<p class=\"has-text-align-center wp-block-paragraph\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">\u4f7f\u7528nerdctl\u547d\u4ee4<\/mark><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ctr \u547d\u4ee4\u529f\u80fd\u592a\u5c11\uff0c\u56e0\u6b64 containerd \u652f\u6301\u5ba2\u6237\u7aef\u5de5\u5177\u6269\u5c55\uff0c\u63a8\u8350\u4f7f\u7528 nerdctl\uff0cnerdctl\u4f7f\u7528\u65b9\u6cd5\u4e0edocker\u547d\u4ee4\u7684\u8bed\u6cd5\u57fa\u672c\u4e00\u81f4\uff0cnerdctl\u4e0d\u4ec5\u4e0edocker\u517c\u5bb9\uff0c\u800c\u4e14\u8fd8\u652f\u6301\u4e86\u66f4\u591a\u7684\u529f\u80fd\uff0c\u53ef\u4f5c\u4e3adocker cli\u7684\u66ff\u4ee3\u54c1<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u9996\u5148\u4e0b\u8f7d\u5e76\u5b89\u88c5nerdctl\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/github.com\/containerd\/nerdctl\/releases\/download\/v1.5.0\/nerdctl-1.5.0-linux-amd64.tar.gz\ntar xf nerdctl-1.5.0-linux-amd64.tar.gz\ncp nerdctl \/usr\/local\/bin\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u67e5\u770bnerdctl\u662f\u5426\u5b89\u88c5\u6210\u529f\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"698\" height=\"87\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/11-1.png\" alt=\"\" class=\"wp-image-14842\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/11-1.png 698w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/11-1-300x37.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/11-1-600x75.png 600w\" sizes=\"auto, (max-width: 698px) 100vw, 698px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u62c9\u53d6nginx\u955c\u50cf\uff0c\u6267\u884c\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nerdctl pull nginx   #\u9ed8\u8ba4\u5c06\u62c9\u53d6docker.io\/library\u4e0b\u7684\u6700\u65b0\u7684nginx\u955c\u50cf<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"696\" height=\"135\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/12-1.png\" alt=\"\" class=\"wp-image-14846\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/12-1.png 696w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/12-1-300x58.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/12-1-600x116.png 600w\" sizes=\"auto, (max-width: 696px) 100vw, 696px\" \/><\/figure>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u6ce8\u610f\uff1anerdctl\u662f\u6ca1\u6709search\u547d\u4ee4\u7684\uff0c\u56e0\u6b64\u4e0d\u80fd\u67e5\u8be2\u955c\u50cf<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">4\u3001\u67e5\u770b\u62c9\u53d6\u7684\u955c\u50cf\uff0c\u6267\u884c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nerdctl images<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"698\" height=\"111\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/1-8.png\" alt=\"\" class=\"wp-image-14848\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/1-8.png 698w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/1-8-300x48.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/1-8-600x95.png 600w\" sizes=\"auto, (max-width: 698px) 100vw, 698px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">5\u3001\u8fd0\u884cnginx\u5bb9\u5668\uff0c\u5e76\u67e5\u770b\u542f\u52a8\u540e\u7684\u5bb9\u5668\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nerdctl run -d --name nginx -p 80:80 nginx   #\u53ef\u6839\u636e\u9700\u8981\u6620\u5c04\u7aef\u53e3\nnerdctl ps<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"696\" height=\"174\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/2-8.png\" alt=\"\" class=\"wp-image-14849\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/2-8.png 696w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/2-8-300x75.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/2-8-600x150.png 600w\" sizes=\"auto, (max-width: 696px) 100vw, 696px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u5176\u4ed6\u547d\u4ee4\u4e0edocker\u547d\u4ee4\u76f8\u5dee\u65e0\u51e0\uff0c\u4f8b\u5982\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nerdctl stop nginx                     #\u505c\u6b62\u5bb9\u5668\nnerdctl start nginx                    #\u542f\u52a8\u5bb9\u5668\nnerdctl exec -it nginx \/bin\/bash       #\u8fdb\u5165\u5bb9\u5668\nnerdctl inspect nginx                  #\u67e5\u770b\u5bb9\u5668\u8be6\u7ec6\u4fe1\u606f\nnerdctl logs nginx                     #\u67e5\u770b\u65e5\u5fd7\u6d88\u606f<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u66f4\u591a\u7528\u6cd5\u53ef\u901a\u8fc7nerdctl &#8211;help\u6765\u67e5\u770b<\/p>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u6ce8\u610f\uff1acontainerd\u662f\u81ea\u5df1\u5b9e\u73b0\u4e86namespace\u529f\u80fd\u7684\uff0cdocker\u662f\u76f4\u63a5\u4f7f\u7528linux\u5185\u6838\u63d0\u4f9b\u7684namespace\u529f\u80fd<\/p>\n","protected":false},"excerpt":{"rendered":"<p>containerd \u662f\u4e00\u4e2a\u5de5\u4e1a\u7ea7\u6807\u51c6\u7684\u5bb9\u5668\u8fd0\u884c\u65f6\uff0c\u5b83\u5f3a\u8c03\u7b80\u5355\u6027\u3001\u5065\u58ee\u6027\u548c\u53ef\u79fb\u690d\u6027\uff0c\u5728Linux\u548cwindow [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":14816,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[],"class_list":["post-14815","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-rong"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":8}},"_links":{"self":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/14815","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/comments?post=14815"}],"version-history":[{"count":26,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/14815\/revisions"}],"predecessor-version":[{"id":14905,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/14815\/revisions\/14905"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media\/14816"}],"wp:attachment":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media?parent=14815"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/categories?post=14815"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/tags?post=14815"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}