{"id":618,"date":"2024-10-16T09:34:16","date_gmt":"2024-10-16T01:34:16","guid":{"rendered":"https:\/\/www.wangzheduo.com\/?p=618"},"modified":"2024-10-16T09:34:16","modified_gmt":"2024-10-16T01:34:16","slug":"linux-debian11%e4%bd%bf%e7%94%a8%e5%9b%bd%e5%86%85%e6%ba%90%e5%ae%89%e8%a3%85podman%e7%8e%af%e5%a2%83","status":"publish","type":"post","link":"https:\/\/www.wangzheduo.com\/?p=618","title":{"rendered":"Linux Debian11\u4f7f\u7528\u56fd\u5185\u6e90\u5b89\u88c5Podman\u73af\u5883"},"content":{"rendered":"<p data-first-child=\"\" data-pid=\"anKhiuwm\"><b>\u4e00\u3001Podman\u7b80\u4ecb<\/b><\/p>\n<p data-pid=\"LH8Vu1Z-\">Podman \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u5bb9\u5668\u8fd0\u884c\u65f6\u9879\u76ee\uff0c\u53ef\u5728\u5927\u591a\u6570 Linux \u5e73\u53f0\u4e0a\u4f7f\u7528\u3002Podman \u63d0\u4f9b\u4e0e Docker \u975e\u5e38\u76f8\u4f3c\u7684\u529f\u80fd\u3002\u6b63\u5982\u524d\u9762\u63d0\u5230\u7684\u90a3\u6837\uff0c\u5b83\u4e0d\u9700\u8981\u5728\u4f60\u7684\u7cfb\u7edf\u4e0a\u8fd0\u884c\u4efb\u4f55\u5b88\u62a4\u8fdb\u7a0b\uff0c\u5e76\u4e14\u5b83\u4e5f\u53ef\u4ee5\u5728\u6ca1\u6709 root \u6743\u9650\u7684\u60c5\u51b5\u4e0b\u8fd0\u884c\u3002<\/p>\n<p data-pid=\"iwduIPfV\">Podman \u53ef\u4ee5\u7ba1\u7406\u548c\u8fd0\u884c\u4efb\u4f55\u7b26\u5408 OCI\uff08Open Container Initiative\uff09\u89c4\u8303\u7684\u5bb9\u5668\u548c\u5bb9\u5668\u955c\u50cf\u3002Podman \u63d0\u4f9b\u4e86\u4e00\u4e2a\u4e0e Docker \u517c\u5bb9\u7684\u547d\u4ee4\u884c\u524d\u7aef\u6765\u7ba1\u7406 Docker \u955c\u50cf\u3002<\/p>\n<p data-pid=\"ygKegNuD\"><a class=\" wrap external\" href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/podman.io\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" data-za-detail-view-id=\"1043\">Podman \u5b98\u7f51\u5730\u5740<\/a><\/p>\n<h3><b>\u4e8c\u3001Debian\u5b89\u88c5Podman<\/b><\/h3>\n<p data-pid=\"8LEW5c4R\">\u9996\u5148\u5207\u6362\u5230root\u8d26\u6237\uff1a<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">su<\/pre>\n<p>&nbsp;<\/p>\n<p data-pid=\"9IlClmLV\">1.\u66f4\u65b0\u7cfb\u7edf\u5230\u6700\u65b0<\/p>\n<div class=\"highlight\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo apt-get update sudo apt-get upgrade<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<p data-pid=\"Lrn6ndLr\">2.\u5b89\u88c5Podman<\/p>\n<div class=\"highlight\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo apt-get -y install podman<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<p data-pid=\"JVvffwf9\">3.\u5e76\u5b89\u88c5\u4e00\u4e9b\u5fc5\u8981\u7cfb\u7edf\u5de5\u5177\u3002<\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-text\">sudo apt-get install \\\r\n  btrfs-progs \\\r\n  git \\\r\n  golang-go \\\r\n  go-md2man \\\r\n  iptables \\\r\n  libassuan-dev \\\r\n  libbtrfs-dev \\\r\n  libc6-dev \\\r\n  libdevmapper-dev \\\r\n  libglib2.0-dev \\\r\n  libgpgme-dev \\\r\n  libgpg-error-dev \\\r\n  libprotobuf-dev \\\r\n  libprotobuf-c-dev \\\r\n  libseccomp-dev \\\r\n  libselinux1-dev \\\r\n  libsystemd-dev \\\r\n  pkg-config \\\r\n  runc \\\r\n  uidmap<\/code><\/pre>\n<\/div>\n<p data-pid=\"-0yugwVe\">4.\u542f\u52a8Podman<\/p>\n<div class=\"highlight\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo systemctl start podman<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<h3><b>\u4e09\u3001\u8bbe\u7f6e\u56fd\u5185\u955c\u50cf\u4ed3\u5e93\u52a0\u901f\u5668<\/b><\/h3>\n<p data-pid=\"c9UKTevE\">1.\u83b7\u53d6\u955c\u50cf\u52a0\u901f\u8854\u63a5<\/p>\n<p data-pid=\"KmKHhikM\">\u963f\u91cc\u4e91\u955c\u50cf\u52a0\u901f\u5730\u5740\uff1a<code>https:\/\/cr.console.aliyun.com\/cn-hangzhou\/instances\/mirrors<\/code><\/p>\n<p data-pid=\"AjEqAe7c\">\u6253\u5f00\u540e\u590d\u5236\u52a0\u901f\u94fe\u63a5\u3002 \u94fe\u63a5\u683c\u5f0f\u4e3a<code>https:\/\/xxxxxxxx.mirror.aliyuncs.com<\/code>\u5176\u4e2dxxxxxxxx\u662f\u4e00\u4e32\u5b57\u6bcd\u548c\u6570\u5b57\u7ec4\u6210\u7684\u5b57\u7b26\uff0c\u6bcf\u4e2a\u4eba\u7684\u4e0d\u4e00\u6837\u3002<\/p>\n<figure data-size=\"normal\">\n<div><img loading=\"lazy\" decoding=\"async\" class=\"origin_image zh-lightbox-thumb lazy\" src=\"https:\/\/pic3.zhimg.com\/80\/v2-604e569e94c91bdfeba74d2bfe3251a2_720w.webp\" width=\"804\" height=\"836\" data-caption=\"\" data-size=\"normal\" data-rawwidth=\"804\" data-rawheight=\"836\" data-original=\"https:\/\/pic3.zhimg.com\/v2-604e569e94c91bdfeba74d2bfe3251a2_r.jpg\" data-actualsrc=\"https:\/\/www.wangzheduo.com\/wp-content\/uploads\/2024\/10\/v2-604e569e94c91bdfeba74d2bfe3251a2_b.jpg\" data-original-token=\"v2-e2d65225bea98be209d11058bd1fcce0\" data-lazy-status=\"ok\" \/><\/div>\n<\/figure>\n<p data-pid=\"yV1ZjhgN\">2.\u5907\u4efd\u539f\u914d\u7f6e\u6587\u4ef6<\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-text\">sudo cp \/etc\/containers\/registries.conf \/etc\/containers\/registries.conf.bak<\/code><\/pre>\n<\/div>\n<p data-pid=\"qtSIGyVj\">3.\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00\u914d\u7f6e\u6587\u4ef6<\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-text\">sudo vi \/etc\/containers\/registries.conf<\/code><\/pre>\n<\/div>\n<p data-pid=\"VwSN8qWs\">4.\u5220\u9664\u539f\u6709\u5185\u5bb9\uff0c\u91cd\u65b0\u7f16\u5199\u6587\u4ef6\u5185\u5bb9\u540e\u4fdd\u5b58,\u4e0b\u9762<b>xxxxxxxx\u662f\u4e2a\u4eba\u963f\u91cc\u4e91ID<\/b><\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-text\"># \u53d6\u6d88\u4ece\u9ed8\u8ba4\u5730\u5740\u641c\u7d22\u7684\u4ed3\u5e93\u57df\u540d\r\nunqualified-search-registries = [\"docker.io\"]\r\n\r\n# \u81ea\u5b9a\u4e49\u641c\u7d22\u5668\r\n[[registry]]\r\n# \u4ed3\u5e93\u524d\u7f00\r\nprefix = \"docker.io\"\r\n# \u52a0\u901f\u5668\u5730\u5740\r\nlocation = \"xxxxxxxx.mirror.aliyuncs.com\"<\/code><\/pre>\n<\/div>\n<p data-pid=\"JqTa72Nf\"><b>\u53e6\u53ef\u9009\u62e9\u4e2d\u79d1\u5927\u6e90<\/b><\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-text\"># \u53d6\u6d88\u4ece\u9ed8\u8ba4\u5730\u5740\u641c\u7d22\u7684\u4ed3\u5e93\u57df\u540d\r\nunqualified-search-registries = [\"docker.io\"]\r\n\r\n# \u81ea\u5b9a\u4e49\u641c\u7d22\u5668\r\n[[registry]]\r\n# \u4ed3\u5e93\u524d\u7f00\r\nprefix = \"docker.io\"\r\n# \u52a0\u901f\u5668\u5730\u5740\r\nlocation = \"docker.mirrors.ustc.edu.cn\"<\/code><\/pre>\n<\/div>\n<p data-pid=\"zX_w2qv_\"><b>\u56db\u3001\u4fee\u6539 SELinux \u914d\u7f6e\u6587\u4ef6\uff0c\u6c38\u4e45\u5173\u95ed SELinux<\/b><\/p>\n<p data-pid=\"X_ks8ROi\">\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00&#8221;\/etc\/selinux\/config&#8221;\u6587\u4ef6\uff1a<\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-text\">sudo vi \/etc\/selinux\/config<\/code><\/pre>\n<\/div>\n<p data-pid=\"EV_fJZBW\">\u5c06 &#8220;SELINUX&#8221; \u53c2\u6570\u8bbe\u7f6e\u4e3a\uff1a&#8221;permissive&#8221; \u6216\u8005 &#8220;disabled&#8221;\uff0c\u5e76\u4fdd\u5b58\uff1a<\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-text\"># enforcing - \u8868\u793a\u542f\u7528 SELinux \u5b89\u5168\u7b56\u7565\u3002\r\n# permissive - \u8868\u793a\u542f\u7528 SELinux \u5b89\u5168\u7b56\u7565\uff0c\u4f46\u4e0d\u5f3a\u5236\u9a8c\u8bc1\u3002\u5982\u679c\u6267\u884c\u7b2c\u4e00\u6b65\u53ef\u4ee5\u6b63\u5e38\u8fd0\u884c\uff0c\u5219\u5efa\u8bae\u8bbe\u7f6e\u6b64\u503c\u3002\r\n# disabled - \u5173\u95ed SELinux \u5b89\u5168\u7b56\u7565\uff0c\u76f8\u5f53\u4e8e\u6ca1\u6709\u5b89\u88c5 SELinux\u3002\r\n\r\nSELINUX=disabled<\/code><\/pre>\n<\/div>\n<p data-pid=\"iF2BiIJU\">\u91cd\u542fDebian\u7cfb\u7edf<\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-text\">reboot<\/code><\/pre>\n<\/div>\n<h3><b>\u4e94\u3001Podman\u6d4b\u8bd5\u662f\u5426\u5b89\u88c5\u6210\u529f<\/b><\/h3>\n<p data-pid=\"Kh9ATfwK\">1.\u5e2e\u52a9\u547d\u4ee4<\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-text\">podman version           # \u663e\u793adocker\u7684\u7248\u672c\u4fe1\u606f\r\npodman info              # \u663e\u793adocker\u7684\u7cfb\u7edf\u4fe1\u606f\uff0c\u5305\u62ec\u955c\u50cf\u548c\u5bb9\u5668\u7684\u6570\u91cf\r\npodman \u547d\u4ee4xxx  --help    # \u5e2e\u52a9\u547d\u4ee4<\/code><\/pre>\n<\/div>\n<p data-pid=\"euFV2JhP\">2.\u901a\u8fc7\u8fd0\u884c hello-world \u955c\u50cf\u6765\u9a8c\u8bc1 Podman \u5f15\u64ce\u662f\u5426\u5df2\u6b63\u786e\u5b89\u88c5\u3002<\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-text\">sudo podman run hello-world<\/code><\/pre>\n<\/div>\n<figure data-size=\"normal\">\n<div><img loading=\"lazy\" decoding=\"async\" class=\"origin_image zh-lightbox-thumb lazy\" src=\"https:\/\/pica.zhimg.com\/80\/v2-56bbfe1857190943d0c5c37f0bea675c_720w.webp\" width=\"726\" height=\"715\" data-caption=\"\" data-size=\"normal\" data-rawwidth=\"726\" data-rawheight=\"715\" data-original=\"https:\/\/pica.zhimg.com\/v2-56bbfe1857190943d0c5c37f0bea675c_r.jpg\" data-actualsrc=\"https:\/\/www.wangzheduo.com\/wp-content\/uploads\/2024\/10\/v2-56bbfe1857190943d0c5c37f0bea675c_b.jpg\" data-original-token=\"v2-f3adade04c68c2e9b1c5f85ccb78a01d\" data-lazy-status=\"ok\" \/><\/div>\n<\/figure>\n<p data-pid=\"YlPQQxkA\">3.Podman\u5217\u51fa\u5b58\u5728\u955c\u50cf\uff1a<code>podman images<\/code><\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-text\">root@debian:~$ podman images\r\nREPOSITORY                     TAG     IMAGE ID      CREATED       SIZE\r\ndocker.io\/library\/hello-world  latest  feb5d9fea6a5  7 months ago  19.9 kB<\/code><\/pre>\n<\/div>\n<h3><b>\u516d\u3001\u5378\u8f7dPodman<\/b><\/h3>\n<div class=\"highlight\">\n<pre><code class=\"language-text\">sudo apt-get remove podman\r\nsudo apt-get purge podman\r\nsudo apt-get autoremove<\/code><\/pre>\n<\/div>\n<p data-pid=\"O7gfrQsP\">\u66f4\u591a\u6280\u672f\u8d44\u6599\u8bf7\u53c2\u8003<a class=\" wrap external\" href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/podman.io\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" data-za-detail-view-id=\"1043\">Podman\u5b98\u7f51<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001Podman\u7b80\u4ecb Podman \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u5bb9\u5668\u8fd0\u884c\u65f6\u9879\u76ee\uff0c\u53ef\u5728\u5927\u591a\u6570 Linux \u5e73\u53f0\u4e0a\u4f7f\u7528\u3002Podman \u63d0\u4f9b\u4e0e Docker \u975e\u5e38\u76f8\u4f3c\u7684\u529f\u80fd\u3002\u6b63\u5982\u524d\u9762\u63d0\u5230\u7684\u90a3\u6837\uff0c\u5b83\u4e0d\u9700\u8981\u5728\u4f60\u7684\u7cfb\u7edf\u4e0a\u8fd0\u884c\u4efb\u4f55&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-618","post","type-post","status-publish","format-standard","hentry","category-docker"],"_links":{"self":[{"href":"https:\/\/www.wangzheduo.com\/index.php?rest_route=\/wp\/v2\/posts\/618","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wangzheduo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wangzheduo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wangzheduo.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wangzheduo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=618"}],"version-history":[{"count":1,"href":"https:\/\/www.wangzheduo.com\/index.php?rest_route=\/wp\/v2\/posts\/618\/revisions"}],"predecessor-version":[{"id":621,"href":"https:\/\/www.wangzheduo.com\/index.php?rest_route=\/wp\/v2\/posts\/618\/revisions\/621"}],"wp:attachment":[{"href":"https:\/\/www.wangzheduo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=618"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wangzheduo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=618"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wangzheduo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=618"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}