{"id":192272,"date":"2020-06-06T08:42:32","date_gmt":"2020-06-06T00:42:32","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=192272"},"modified":"2020-06-20T09:02:26","modified_gmt":"2020-06-20T01:02:26","slug":"ubuntu-install-docker-ce","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/ubuntu-install-docker-ce.html","title":{"rendered":"Ubuntu\u5b89\u88c5\u548c\u914d\u7f6eDocker-CE\u955c\u50cf\u52a0\u901f"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nDocker\u662f\u4e00\u79cd\u5bb9\u5668\u5316\u6280\u672f\uff0c\u5b83\u53ef\u4ee5\u8ba9\u4f60\u5feb\u901f\u6784\u5efa\u3001\u6d4b\u8bd5\u548c\u90e8\u7f72\u5e94\u7528\u7a0b\u5e8f\uff0c\u5e76\u5c06\u5176\u4f5c\u4e3a\u53ef\u79fb\u690d\u3001\u81ea\u7ed9\u81ea\u8db3\u7684\u5bb9\u5668\uff0c\u51e0\u4e4e\u53ef\u4ee5\u5728\u4efb\u4f55\u5730\u65b9\u8fd0\u884c\u3002Docker\u5df2\u7ecf\u6210\u4e3a\u5bb9\u5668\u90e8\u7f72\u7684\u4e8b\u5b9e\u6807\u51c6\uff0c\u5b83\u662fDevOps\u5de5\u7a0b\u5e08\u53ca\u5176\u6301\u7eed\u96c6\u6210\u548c\u4ea4\u4ed8\u7ba1\u9053\u7684\u5fc5\u5907\u5de5\u5177\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u5b9e\u9a8c\u73af\u5883<\/strong><\/div>\n

\u64cd\u4f5c\u7cfb\u7edf\uff1aUbuntu 18.04.4 LTS<\/p>\n

LAN IP \uff1a192.168.3.22<\/p>\n

\"\"<\/p>\n

Docker\u662f\u73b0\u4ee3\u8f6f\u4ef6\u5f00\u53d1\u548cDevOps\u6301\u7eed\u96c6\u6210\u548c\u90e8\u7f72\u7ba1\u9053\u4e2d\u4e0d\u53ef\u6216\u7f3a\u7684\u4e00\u90e8\u5206,\u5927\u90e8\u5206\u516c\u53f8\u90fd\u4f7f\u7528\u5bb9\u5668\u5316\u6280\u672f\uff0c\u964d\u4f4e\u670d\u52a1\u5668\u6210\u672c\u3002<\/p>\n

\u5b89\u88c5\u5fc5\u8981\u7684\u7cfb\u7edf\u8d44\u6e90\u5e93<\/strong><\/span><\/div>\n
\r\nroot@linuxcool:~# apt-get update\r\nroot@linuxcool:~# apt-get -y install apt-transport-https ca-certificates curl software-properties-common\r\n<\/pre>\n
\u5b89\u88c5GPG\u8bc1\u4e66<\/strong><\/span><\/div>\n
\r\nroot@linuxcool:~# curl -fsSL https:\/\/mirrors.nwafu.edu.cn\/docker-ce\/linux\/ubuntu\/gpg | apt-key add -\r\n<\/pre>\n

Docker\u670d\u52a1\u5668\u5728\u56fd\u5916\uff0c\u5982\u679c\u4f7f\u7528docker.io\u6765\u5b89\u88c5docker\u4f1a\u975e\u5e38\u6162\uff0c\u6709\u65f6\u5019\u8fd8\u4f1a\u8d85\u65f6\u65ad\u5f00\u5bfc\u81f4\u65e0\u6cd5\u5b89\u88c5\u6210\u529f\uff1b\u6240\u4ee5\uff0c\u6211\u8fd9\u91cc\u4f7f\u7528\u7684\u662f\u56fd\u5185\u201c\u897f\u5317\u519c\u6797\u79d1\u6280\u5927\u5b66\u7f51\u7edc\u4e0e\u6559\u80b2\u6280\u672f\u4e2d\u5fc3\u201d\u955c\u50cf\u52a0\u901f\uff0c\u56fd\u5185\u8fd8\u6709\u5f88\u591a\u955c\u50cf\u52a0\u901f\u7ad9\u70b9\uff0c\u6bd4\u5982\uff1a\u963f\u91cc\u4e91\u3001\u817e\u8baf\u4e91\u3001\u7f51\u6613\u3001\u6e05\u534e\u5927\u5b66\u7b49\uff0c<\/p>\n

\u66f4\u65b0\u7cfb\u7edf\u5e76\u5b89\u88c5Docker-CE<\/strong><\/span><\/div>\n
\r\nroot@linuxcool:~# apt-get -y update\r\nroot@linuxcool:~# apt-get -y install docker-ce\r\n<\/pre>\n

\u901a\u8fc7\u4ee5\u4e0a\u547d\u4ee4\u5b89\u88c5\u7684\u662fdocker\u6700\u65b0\u7248\u672c\uff0c\u5982\u679c\u8981\u5b89\u88c5docker\uff0c\u8bf7\u7ee7\u7eed\u9605\u8bfb\u4e0b\u6587\uff0c<\/p>\n

\u67e5\u627eDocker-CE\u7684\u7248\u672c<\/p>\n

\r\napt-cache madison docker-ce\r\n docker-ce | 5:19.03.8~3-0~ubuntu-bionic | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n docker-ce | 5:19.03.7~3-0~ubuntu-bionic | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n docker-ce | 5:19.03.6~3-0~ubuntu-bionic | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n docker-ce | 5:19.03.5~3-0~ubuntu-bionic | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n docker-ce | 5:19.03.4~3-0~ubuntu-bionic | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n docker-ce | 5:19.03.3~3-0~ubuntu-bionic | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n docker-ce | 5:19.03.2~3-0~ubuntu-bionic | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n docker-ce | 5:19.03.1~3-0~ubuntu-bionic | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n docker-ce | 5:19.03.0~3-0~ubuntu-bionic | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n docker-ce | 5:18.09.9~3-0~ubuntu-bionic | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n docker-ce | 5:18.09.8~3-0~ubuntu-bionic | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n docker-ce | 5:18.09.7~3-0~ubuntu-bionic | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n docker-ce | 5:18.09.6~3-0~ubuntu-bionic | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n docker-ce | 5:18.09.5~3-0~ubuntu-bionic | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n docker-ce | 5:18.09.4~3-0~ubuntu-bionic | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n docker-ce | 5:18.09.3~3-0~ubuntu-bionic | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n docker-ce | 5:18.09.2~3-0~ubuntu-bionic | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n docker-ce | 5:18.09.1~3-0~ubuntu-bionic | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n docker-ce | 5:18.09.0~3-0~ubuntu-bionic | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n docker-ce | 18.06.3~ce~3-0~ubuntu | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n docker-ce | 18.06.2~ce~3-0~ubuntu | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n docker-ce | 18.06.1~ce~3-0~ubuntu | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n docker-ce | 18.06.0~ce~3-0~ubuntu | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n docker-ce | 18.03.1~ce~3-0~ubuntu | https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/ubuntu bionic\/stable amd64 Packages\r\n<\/pre>\n

\u5b89\u88c5\u6307\u5b9a\u7248\u672c\u7684Docker-CE\uff0c\u6bd4\u5982\u8981\u5b89\u88c519.03.8~3-0~ubuntu-bionic<\/p>\n

\r\nroot@linuxcool:~# apt-get -y install docker-ce=19.03.8~3-0~ubuntu-bionic\r\n<\/pre>\n
\u5b89\u88c5\u6821\u9a8c<\/strong><\/span><\/div>\n
\r\nroot@linuxcool:~# docker version\r\nClient: Docker Engine - Community\r\n Version:           19.03.8\r\n API version:       1.40\r\n Go version:        go1.12.17\r\n Git commit:        afacb8b7f0\r\n Built:             Wed Mar 11 01:25:46 2020\r\n OS\/Arch:           linux\/amd64\r\n Experimental:      false\r\n\r\nServer: Docker Engine - Community\r\n Engine:\r\n  Version:          19.03.8\r\n  API version:      1.40 (minimum version 1.12)\r\n  Go version:       go1.12.17\r\n  Git commit:       afacb8b7f0\r\n  Built:            Wed Mar 11 01:24:19 2020\r\n  OS\/Arch:          linux\/amd64\r\n  Experimental:     false\r\n containerd:\r\n  Version:          1.2.13\r\n  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429\r\n runc:\r\n  Version:          1.0.0-rc10\r\n  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd\r\n docker-init:\r\n  Version:          0.18.0\r\n  GitCommit:        fec3683\r\n<\/pre>\n
\u914d\u7f6e\u955c\u50cf\u52a0\u901f<\/strong><\/span><\/div>\n

\u521b\u5efadaemon.json\u914d\u7f6e\u6587\u4ef6<\/p>\n

\r\nroot@linuxcool:~# vim \/etc\/docker\/daemon.json\r\n{\r\n  \"registry-mirrors\": [\"https:\/\/dockerhub.mirrors.nwafu.edu.cn\/\"]\r\n}\r\n<\/pre>\n

\u9ed8\u8ba4daemon.json\u6587\u4ef6\u4e0d\u5b58\u5728\uff0c\u5982\u679cdaemon.json\u6587\u4ef6\u4e0d\u5b58\u5728\uff0c\u81ea\u5df1\u521b\u5efa<\/p>\n

\u52a0\u8f7d\u914d\u7f6e\uff0c\u91cd\u542fdocker\u670d\u52a1<\/strong><\/span><\/div>\n
\r\nroot@linuxcool:~# systemctl daemon-reload\r\nroot@linuxcool:~# systemctl restart docker\r\n<\/pre>\n
\u9a8c\u8bc1\u955c\u50cf\u52a0\u901f\u662f\u5426\u914d\u7f6e\u751f\u6548<\/strong><\/span><\/div>\n
\r\nroot@linuxcool:~# docker info \r\nClient:\r\n Debug Mode: false\r\n\r\nServer:\r\n Containers: 0\r\n  Running: 0\r\n  Paused: 0\r\n  Stopped: 0\r\n Images: 0\r\n Server Version: 19.03.8\r\n Storage Driver: overlay2\r\n  Backing Filesystem: \r\n  Supports d_type: true\r\n  Native Overlay Diff: true\r\n Logging Driver: json-file\r\n Cgroup Driver: cgroupfs\r\n Plugins:\r\n  Volume: local\r\n  Network: bridge host ipvlan macvlan null overlay\r\n  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog\r\n Swarm: inactive\r\n Runtimes: runc\r\n Default Runtime: runc\r\n Init Binary: docker-init\r\n containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429\r\n runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd\r\n init version: fec3683\r\n Security Options:\r\n  apparmor\r\n  seccomp\r\n   Profile: default\r\n Kernel Version: 5.3.0-51-generic\r\n Operating System: Ubuntu 18.04.4 LTS\r\n OSType: linux\r\n Architecture: x86_64\r\n CPUs: 8\r\n Total Memory: 15.64GiB\r\n Name: linuxcool\r\n ID: K252:G32L:GWWN:J5FE:3MFZ:2ITG:UE7Y:Y26F:QT3Q:2PLS:HCUX:PJYZ\r\n Docker Root Dir: \/var\/lib\/docker\r\n Debug Mode: false\r\n Registry: https:\/\/index.docker.io\/v1\/\r\n Labels:\r\n Experimental: false\r\n Insecure Registries:\r\n  127.0.0.0\/8\r\n Registry Mirrors:\r\n  https:\/\/dockerhub.mirrors.nwafu.edu.cn\/\r\n Live Restore Enabled: false\r\n\r\nWARNING: No swap limit support\r\n<\/unknown><\/pre>\n

Registry Mirrors\u9ed8\u8ba4\u662fdocker.io\uff0c\u5982\u679c\u770b\u5230Registry Mirrors\u53d8https:\/\/dockerhub.mirrors.nwafu.edu.cn\u8bf4\u660e\u914d\u7f6e\u5df2\u7ecf\u751f\u6548\u3002<\/p>\n

docker\u670d\u52a1\u7ba1\u7406<\/strong><\/span><\/div>\n
\r\n#\u81ea\u542f\u670d\u52a1\r\nroot@linuxcool:~# systemctl enable docker.service\r\n#\u670d\u52a1\u72b6\u6001\r\nroot@linuxcool:~# systemctl status docker.service\r\n#\u542f\u52a8\u670d\u52a1\r\nroot@linuxcool:~# systemctl start docker.service\r\n#\u91cd\u542f\u670d\u52a1\r\nroot@linuxcool:~# systemctl restart docker.service\r\n#\u505c\u6b62\u670d\u52a1\r\nroot@linuxcool:~# systemctl stop docker.service\r\n<\/pre>\n
\u62c9\u53d6\u955c\u50cf<\/strong><\/span><\/div>\n
\r\nroot@linuxcool:~# docker pull centos:8.1.1911\r\n8.1.1911: Pulling from library\/centos\r\n8a29a15cefae: Pull complete \r\nDigest: sha256:fe8d824220415eed5477b63addf40fb06c3b049404242b31982106ac204f6700\r\nStatus: Downloaded newer image for centos:8.1.1911\r\ndocker.io\/library\/centos:8.1.1911\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"

\u64cd\u4f5c\u7cfb\u7edf\uff1aUbuntu 18.04.4 LTS LAN IP \uff1a192.168.3.22 Docker\u662f\u73b0\u4ee3\u8f6f […]<\/p>\n","protected":false},"author":1479,"featured_media":192273,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-192272","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/192272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1479"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=192272"}],"version-history":[{"count":6,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/192272\/revisions"}],"predecessor-version":[{"id":194177,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/192272\/revisions\/194177"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/192273"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=192272"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=192272"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=192272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}