{"id":156490,"date":"2019-09-09T08:23:57","date_gmt":"2019-09-09T00:23:57","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=156490"},"modified":"2019-08-26T09:24:54","modified_gmt":"2019-08-26T01:24:54","slug":"centos-7-yum-docker","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/centos-7-yum-docker.html","title":{"rendered":"\u6559\u4f60\u5982\u4f55\u5728 CentOS 7 \u4e0b yum \u65b9\u5f0f\u5b89\u88c5 Docker \u73af\u5883"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u6559\u4f60\u5982\u4f55\u5728 CentOS 7 \u4e0b yum \u65b9\u5f0f\u5b89\u88c5 Docker \u73af\u5883\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u8bb0\u5f55\u5728CentOS 7\u4e0b\u4f7f\u7528yum\u65b9\u5f0f\u5b89\u88c5Docker\u73af\u5883\u7684\u6b65\u9aa4\u3002<\/p>\n

1\u3001\u79fb\u9664\u65e7\u7248\u672c\uff1a<\/strong><\/span><\/div>\n
yum remove docker \\\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 docker-client \\\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 docker-client-latest \\\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 docker-common \\\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 docker-latest \\\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 docker-latest-logrotate \\\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 docker-logrotate \\\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 docker-selinux \\\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 docker-engine-selinux \\\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 docker-engine\r\nrm -rf \/etc\/systemd\/system\/docker.service.d\r\nrm -rf \/var\/lib\/docker\r\nrm -rf \/var\/run\/docker\r\nrm -rf \/usr\/local\/docker\r\nrm -rf \/etc\/docker<\/pre>\n
2\u3001\u5b89\u88c5\u4e00\u4e9b\u5fc5\u8981\u7684\u7cfb\u7edf\u5de5\u5177\uff1a<\/strong><\/span><\/div>\n
yum -y install yum-utils device-mapper-persistent-data lvm2<\/pre>\n
3\u3001\u6dfb\u52a0\u8f6f\u4ef6\u6e90\u4fe1\u606f\uff1a<\/strong><\/span><\/div>\n
yum-config-manager --add-repo http:\/\/mirrors.aliyun.com\/docker-ce\/linux\/centos\/docker-ce.repo<\/pre>\n
4\u3001\u66f4\u65b0 yum \u7f13\u5b58\uff1a<\/strong><\/span><\/div>\n
yum makecache fast<\/pre>\n
5\u3001\u5b89\u88c5 Docker-ce\uff1a<\/strong><\/span><\/div>\n
yum -y install docker-ce<\/pre>\n
6\u3001\u542f\u52a8 Docker \u540e\u53f0\u670d\u52a1\uff1a<\/strong><\/span><\/div>\n
systemctl start docker<\/pre>\n
7\u3001\u6d4b\u8bd5\u8fd0\u884c hello-world\uff1a<\/strong><\/span><\/div>\n
docker run hello-world<\/pre>\n
8\u3001\u5b89\u88c5centos\uff0c\u5e76\u4ee5\u540e\u53f0\u542f\u52a8\u7684\u65b9\u5f0f\u8fd0\u884ccentos\uff1a<\/strong><\/span><\/div>\n
docker run -itd centos \/bin\/bash<\/pre>\n
9\u3001\u8fdb\u5165centos\u955c\u50cf\uff1a<\/strong><\/span><\/div>\n
[root@myserver ~]# docker ps\r\nCONTAINER ID\u00a0 \u00a0 \u00a0 \u00a0 IMAGE\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 COMMAND\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 CREATED\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 STATUS\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 PORTS\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 NAMES\r\nf57d4703adc3\u00a0 \u00a0 \u00a0 \u00a0 centos\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \"\/bin\/bash\"\u00a0 \u00a0 \u00a0 \u00a0 About a minute ago\u00a0 Up About a minute\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 jolly_dhawan\r\n[root@myserver ~]# docker exec -it f57d4703adc3 \/bin\/bash\r\n[root@f57d4703adc3 \/]#\r\n[root@f57d4703adc3 \/]# cat \/etc\/RedHat-release \r\nCentOS Linux release 7.6.1810 (Core) \r\n[root@f57d4703adc3 \/]#<\/pre>\n

\u81f3\u6b64\uff0cDocker\u73af\u5883\u642d\u5efa\u5b8c\u6210\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u8bb0\u5f55\u5728CentOS 7\u4e0b\u4f7f\u7528yum\u65b9\u5f0f\u5b89\u88c5Docker\u73af\u5883\u7684\u6b65\u9aa4\u3002 yum remove docker \\ \u00a0 […]<\/p>\n","protected":false},"author":63,"featured_media":156493,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-156490","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\/156490","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\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=156490"}],"version-history":[{"count":4,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/156490\/revisions"}],"predecessor-version":[{"id":157077,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/156490\/revisions\/157077"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/156493"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=156490"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=156490"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=156490"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}