{"id":17953,"date":"2024-11-18T13:36:19","date_gmt":"2024-11-18T05:36:19","guid":{"rendered":"https:\/\/fwq.ai\/blog\/17953\/"},"modified":"2024-11-18T13:36:19","modified_gmt":"2024-11-18T05:36:19","slug":"centos%e6%80%8e%e4%b9%88%e5%ae%89%e8%a3%85docker","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/17953\/","title":{"rendered":"centos\u600e\u4e48\u5b89\u88c5docker"},"content":{"rendered":"<blockquote><p>\n  \u8981\u5728 centos \u4e0a\u5b89\u88c5 docker\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a1. \u6dfb\u52a0 docker \u5b98\u65b9\u4ed3\u5e93\uff1b2. \u5b89\u88c5 docker \u5f15\u64ce\uff1b3. \u542f\u7528\u5e76\u542f\u52a8 docker\uff1b4. \u9a8c\u8bc1\u5b89\u88c5\uff1b5. \u6dfb\u52a0\u7528\u6237\u5230 docker \u7ec4\uff1b6. \u6ce8\u9500\u5e76\u91cd\u65b0\u767b\u5f55\uff1b7. \u6d4b\u8bd5\u975e root \u7528\u6237\u7684 docker \u8bbf\u95ee\u6743\u9650\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202404\/07\/2024040719511532579.jpg\" class=\"aligncenter\" title=\"centos\u600e\u4e48\u5b89\u88c5docker\u63d2\u56fe\" alt=\"centos\u600e\u4e48\u5b89\u88c5docker\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728 CentOS \u4e0a\u5b89\u88c5 Docker<\/strong><\/p>\n<p><strong>\u5148\u51b3\u6761\u4ef6\uff1a<\/strong><\/p>\n<ul>\n<li>CentOS 7 \u6216\u66f4\u9ad8\u7248\u672c<\/li>\n<li>\u5177\u6709 root \u6743\u9650\u7684\u7528\u6237<\/li>\n<\/ul>\n<p><strong>\u6b65\u9aa4\uff1a<\/strong><\/p>\n<p><strong>1. \u6dfb\u52a0 Docker \u5b98\u65b9\u4ed3\u5e93<\/strong><\/p>\n<pre>sudo yum-config-manager --add-repo https:\/\/download.docker.com\/linux\/centos\/docker-ce.repo<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>2. \u5b89\u88c5 Docker \u5f15\u64ce<\/strong><\/p>\n<pre>sudo yum install docker-ce docker-ce-cli containerd.io<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u542f\u7528\u548c\u542f\u52a8 Docker<\/strong><\/p>\n<pre>sudo systemctl start docker\nsudo systemctl enable docker<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u9a8c\u8bc1\u5b89\u88c5<\/strong><\/p>\n<pre>sudo docker run hello-world<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5982\u679c\u8f93\u51fa\u7c7b\u4f3c\u4e8e\u4ee5\u4e0b\u5185\u5bb9\uff0c\u5219\u8868\u793a Docker \u5df2\u6210\u529f\u5b89\u88c5\u5e76\u6b63\u5728\u8fd0\u884c\uff1a<\/p>\n<pre>Hello from Docker!\nThis message shows that your installation appears to be working correctly.<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>5. \u6dfb\u52a0\u7528\u6237\u5230 Docker \u7ec4<\/strong><\/p>\n<p>\u4e3a\u4e86\u5141\u8bb8\u975e root \u7528\u6237\u8fd0\u884c Docker \u547d\u4ee4\uff0c\u60a8\u9700\u8981\u5c06\u5b83\u4eec\u6dfb\u52a0\u5230  \u7ec4\u4e2d\uff1a<\/p>\n<pre>sudo groupadd docker\nsudo usermod -aG docker $USER<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>6. \u6ce8\u9500\u5e76\u91cd\u65b0\u767b\u5f55<\/strong><\/p>\n<p>\u4f7f\u7ec4\u6210\u5458\u8d44\u683c\u66f4\u6539\u751f\u6548\u540e\uff0c\u60a8\u9700\u8981\u6ce8\u9500\u5e76\u91cd\u65b0\u767b\u5f55\u624d\u80fd\u4f7f\u7528 Docker \u547d\u4ee4\u3002<\/p>\n<p><strong>7. \u6d4b\u8bd5\u975e root \u7528\u6237\u7684 Docker \u8bbf\u95ee\u6743\u9650<\/strong><\/p>\n<p>\u73b0\u5728\u60a8\u53ef\u4ee5\u4f7f\u7528\u975e root \u7528\u6237\u8fd0\u884c Docker \u547d\u4ee4\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre>docker run -it alpine \/bin\/sh<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5982\u679c\u4e00\u5207\u6b63\u5e38\uff0c\u60a8\u5e94\u8be5\u4f1a\u770b\u5230 Alpine Linux \u7684 shell \u63d0\u793a\u7b26\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u5b89\u88c5\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8981\u5728 centos \u4e0a\u5b89\u88c5 docker\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a1. \u6dfb\u52a0 docker \u5b98\u65b9\u4ed3\u5e93\uff1b2. \u5b89\u88c5 docker \u5f15\u64ce\uff1b3. \u542f\u7528\u5e76\u542f\u52a8 docker\uff1b4. \u9a8c\u8bc1\u5b89\u88c5\uff1b5. \u6dfb\u52a0\u7528\u6237\u5230 docker \u7ec4\uff1b6. \u6ce8\u9500\u5e76\u91cd\u65b0\u767b\u5f55\uff1b7. \u6d4b\u8bd5\u975e root \u7528\u6237\u7684 docker \u8bbf\u95ee\u6743\u9650\u3002 \u5982\u4f55\u5728 CentOS \u4e0a\u5b89\u88c5 Docker \u5148\u51b3\u6761\u4ef6\uff1a CentOS 7 \u6216\u66f4\u9ad8\u7248\u672c \u5177\u6709 root \u6743\u9650\u7684\u7528\u6237 \u6b65\u9aa4\uff1a 1. \u6dfb\u52a0 Docker \u5b98\u65b9\u4ed3\u5e93 sudo yum-config-manager &#8211;add-repo https:\/\/download.docker.com\/linux\/centos\/docker-ce.repo \u767b\u5f55\u540e\u590d\u5236 2. \u5b89\u88c5 Docker \u5f15\u64ce sudo yum install docker-ce docker-ce-cli containerd.io \u767b\u5f55\u540e\u590d\u5236 3. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-17953","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/17953","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=17953"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/17953\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=17953"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=17953"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=17953"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}