{"id":641,"date":"2023-02-26T13:33:13","date_gmt":"2023-02-26T05:33:13","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=641"},"modified":"2023-04-29T19:58:39","modified_gmt":"2023-04-29T11:58:39","slug":"install-docker-under-centos-7","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/26\/install-docker-under-centos-7\/","title":{"rendered":"Centos 7\u4e0b\u5b89\u88c5Docker"},"content":{"rendered":"<p>\u53c2\u8003\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/docs.docker.com\/engine\/installation\/linux\/centos\/\">https:\/\/docs.docker.com\/engine\/installation\/linux\/centos\/<\/a><\/p>\n<h2>\u79fb\u9664\u65e7\u7248\u672c<\/h2>\n<pre><code>$ sudo yum remove docker docker-common container-selinux docker-selinux docker-engine<\/code><\/pre>\n<p><!-- more --><\/p>\n<h2>\u5b89\u88c5Docker CE<\/h2>\n<p>\uff081\uff09\u5b89\u88c5 yum-utils\uff0c\u63d0\u4f9b yum-config-manager \u529f\u80fd<\/p>\n<pre><code>$ sudo yum install -y yum-utils<\/code><\/pre>\n<p>\uff082\uff09\u6dfb\u52a0 stable\u4ed3\u5e93<\/p>\n<pre><code>$ sudo yum-config-manager --add-repo https:\/\/download.docker.com\/linux\/centos\/docker-ce.repo<\/code><\/pre>\n<p>\uff083\uff09\u4f7f\u80fd edge\u4ed3\u5e93\uff08\u53ef\u9009\uff09<\/p>\n<pre><code>$ sudo yum-config-manager --enable docker-ce-edge (\u5f00\u542f)\n$ sudo yum-config-manager --disable docker-ce-edge (\u7981\u7528)<\/code><\/pre>\n<p>\uff084\uff09\u66f4\u65b0 yum\u5305<\/p>\n<pre><code>$ sudo yum makecache fast<\/code><\/pre>\n<p>\uff085\uff09\u5b89\u88c5 Docker\u6700\u65b0\u7248\u672c<\/p>\n<pre><code>$ sudo yum install docker-ce<\/code><\/pre>\n<p>\uff086\uff09\u5b89\u88c5 Docker\u6307\u5b9a\u7248\u672c<\/p>\n<pre><code>$ yum list docker-ce.x86_64 --showduplicates |sort -r\ndocker-ce.x86_64            17.03.0.ce-1.el7.centos             docker-ce-stable\n\n$ sudo yum install docker-ce-17.03.0.ce-1.el7.centos.x86_64<\/code><\/pre>\n<p>\uff087\uff09\u67e5\u770b Docker\u7248\u672c<\/p>\n<pre><code>$ docker -v\nDocker version 17.03.0-ce, build 3a232c8<\/code><\/pre>\n<p>\uff088\uff09\u542f\u52a8 Docker\u670d\u52a1<\/p>\n<pre><code>$ sudo systemctl start docker<\/code><\/pre>\n<p>\uff089\uff09\u6d4b\u8bd5 Docker \u8fd0\u884c hello-world \u955c\u50cf<\/p>\n<pre><code>$ sudo docker run hello-world<\/code><\/pre>\n<p>\uff0810\uff09\u663e\u793a\u6b63\u5728\u8fd0\u884c\u7684\u6240\u6709 Docker\u5bb9\u5668<\/p>\n<pre><code>$ sudo docker ps -a<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u53c2\u8003\uff1ahttps:\/\/docs.docker.com\/engine\/installation\/linux\/ce [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[179],"tags":[178],"class_list":["post-641","post","type-post","status-publish","format-standard","hentry","category-docker","tag-docker"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/641","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=641"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/641\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=641"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}