{"id":467,"date":"2020-03-01T22:46:52","date_gmt":"2020-03-01T14:46:52","guid":{"rendered":"https:\/\/harson.co\/?p=467"},"modified":"2020-03-26T20:09:45","modified_gmt":"2020-03-26T12:09:45","slug":"docker-on-centos","status":"publish","type":"post","link":"https:\/\/harson.co\/index.php\/2020\/03\/01\/docker-on-centos\/","title":{"rendered":"Docker On CentOS"},"content":{"rendered":"<p>yum\u66f4\u65b0<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">sudo yum update<\/code><\/pre>\n<p>\u5378\u8f7d\u65e7\u7248\u672c(\u5982\u679c\u5b89\u88c5\u8fc7\u65e7\u7248\u672c\u7684\u8bdd)<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">sudo yum remove docker  docker-common docker-selinux docker-engine<\/code><\/pre>\n<p>\u5b89\u88c5\u9700\u8981\u7684\u8f6f\u4ef6\u5305\uff0c\u00a0yum-util \u63d0\u4f9byum-config-manager\u529f\u80fd\uff0c<span class=\"pln\"><span class=\"com\">\u53e6\u5916\u4e24\u4e2a\u662fdevicemapper\u9a71\u52a8\u4f9d\u8d56\u7684<\/span><\/span><\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">sudo yum install -y yum-utils device-mapper-persistent-data lvm2<\/code><\/pre>\n<p>\u8bbe\u7f6eyum\u6e90<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">sudo yum-config-manager --add-repo https:\/\/download.docker.com\/linux\/centos\/docker-ce.repo<\/code><\/pre>\n<p>\u53ef\u4ee5\u67e5\u770b\u6240\u6709\u4ed3\u5e93\u4e2d\u6240\u6709docker\u7248\u672c\uff0c\u5e76\u9009\u62e9\u7279\u5b9a\u7248\u672c\u5b89\u88c5<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">yum list docker-ce --showduplicates | sort -r<\/code><\/pre>\n<p>\u9009\u62e9\u5b89\u88c5\u7248\u672c<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">sudo yum install docker-ce-17.12.0.ce<\/code><\/pre>\n<p>\u542f\u52a8\u5e76\u52a0\u5165\u5f00\u673a\u542f\u52a8<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">sudo systemctl start docker\r\nsudo systemctl enable docker<\/code><\/pre>\n<p>\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f(\u6709client\u548cservice\u4e24\u90e8\u5206\u8868\u793adocker\u5b89\u88c5\u542f\u52a8\u90fd\u6210\u529f\u4e86)<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">docker version<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>Docker\u6362\u6e90<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">sudo mkdir -p \/etc\/docker<\/code><\/pre>\n<p>\u7f16\u8f91 \/etc\/docker\/daemon.json<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">{\r\n  \"registry-mirrors\": [\"https:\/\/xxx.mirror.aliyuncs.com\"]\r\n}<\/code><\/pre>\n<p>\uff08\u9700\u8981\u767b\u5f55\u963f\u91cc\u4e91\u83b7\u53d6\u94fe\u63a5\uff09<\/p>\n<p>&nbsp;<\/p>\n<p>Dockerfile\u89c4\u5219<\/p>\n<p>https:\/\/www.cnblogs.com\/edisonchou\/p\/dockerfile_inside_introduction.html<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>yum\u66f4\u65b0 sudo yum update \u5378\u8f7d\u65e7\u7248\u672c(\u5982\u679c\u5b89\u88c5\u8fc7\u65e7\u7248\u672c\u7684\u8bdd) sudo yum remove [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-467","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/harson.co\/index.php\/wp-json\/wp\/v2\/posts\/467","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/harson.co\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/harson.co\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/harson.co\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/harson.co\/index.php\/wp-json\/wp\/v2\/comments?post=467"}],"version-history":[{"count":1,"href":"https:\/\/harson.co\/index.php\/wp-json\/wp\/v2\/posts\/467\/revisions"}],"predecessor-version":[{"id":468,"href":"https:\/\/harson.co\/index.php\/wp-json\/wp\/v2\/posts\/467\/revisions\/468"}],"wp:attachment":[{"href":"https:\/\/harson.co\/index.php\/wp-json\/wp\/v2\/media?parent=467"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/harson.co\/index.php\/wp-json\/wp\/v2\/categories?post=467"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/harson.co\/index.php\/wp-json\/wp\/v2\/tags?post=467"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}