{"id":1062,"date":"2021-05-14T11:00:42","date_gmt":"2021-05-14T03:00:42","guid":{"rendered":"https:\/\/www.linuxdevops.cn\/?p=1062"},"modified":"2022-06-24T10:21:42","modified_gmt":"2022-06-24T02:21:42","slug":"installing-docker-and-docker-compose-in-centos7","status":"publish","type":"post","link":"https:\/\/www.linuxdevops.cn\/2021\/05\/installing-docker-and-docker-compose-in-centos7\/","title":{"rendered":"Centos7 \u5b89\u88c5docker \u548cdocker-compose"},"content":{"rendered":"
## docker\u963f\u91cc\u4e91\u6e90\n\ncurl -o \/etc\/yum.repos.d\/docker-ce.repo https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/centos\/docker-ce.repo\n\n### Install required packages for docker.\n\nyum install -y device-mapper-persistent-data lvm2\nyum install -y docker-ce-19.03.8\n\n## Create \/etc\/docker directory.\n\nmkdir \/etc\/docker\n\n# Setup daemon.\n\ncat > \/etc\/docker\/daemon.json <<EOF\n{\n  "registry-mirrors": ["https:\/\/lqetgo1f.mirror.aliyuncs.com","https:\/\/docker.mirrors.ustc.edu.cn\/"]\n}\nEOF\n\nmkdir -p \/etc\/systemd\/system\/docker.service.d\n\n# Restart Docker\n\nsystemctl daemon-reload\nsystemctl restart docker\nsystemctl enable docker\n\n## \u5b89\u88c5docker-compose\n\nsudo curl -L "https:\/\/github.com\/docker\/compose\/releases\/download\/1.29.1\/docker-compose-$(uname -s)-$(uname -m)" -o \/usr\/bin\/docker-compose\nsudo chmod +x \/usr\/bin\/docker-compose\ndocker-compose --version<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"

## docker\u963f\u91cc\u4e91\u6e90 curl -o \/etc\/yum.repos.d\/docker-ce.repo h<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34,17],"tags":[],"yoast_head":"\nCentos7 \u5b89\u88c5docker \u548cdocker-compose - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.linuxdevops.cn\/2021\/05\/installing-docker-and-docker-compose-in-centos7\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Centos7 \u5b89\u88c5docker \u548cdocker-compose - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\" \/>\n<meta property=\"og:description\" content=\"## docker\u963f\u91cc\u4e91\u6e90 curl -o \/etc\/yum.repos.d\/docker-ce.repo h\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.linuxdevops.cn\/2021\/05\/installing-docker-and-docker-compose-in-centos7\/\" \/>\n<meta property=\"og:site_name\" content=\"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\" \/>\n<meta property=\"article:published_time\" content=\"2021-05-14T03:00:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-24T02:21:42+00:00\" \/>\n<meta name=\"author\" content=\"\u7ba1\u7406\u5458\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.linuxdevops.cn\/2021\/05\/installing-docker-and-docker-compose-in-centos7\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/2021\/05\/installing-docker-and-docker-compose-in-centos7\/\"},\"author\":{\"name\":\"\u7ba1\u7406\u5458\",\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\"},\"headline\":\"Centos7 \u5b89\u88c5docker \u548cdocker-compose\",\"datePublished\":\"2021-05-14T03:00:42+00:00\",\"dateModified\":\"2022-06-24T02:21:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/2021\/05\/installing-docker-and-docker-compose-in-centos7\/\"},\"wordCount\":3,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\"},\"articleSection\":[\"Kubernetes\",\"Linux\"],\"inLanguage\":\"zh-CN\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.linuxdevops.cn\/2021\/05\/installing-docker-and-docker-compose-in-centos7\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.linuxdevops.cn\/2021\/05\/installing-docker-and-docker-compose-in-centos7\/\",\"url\":\"https:\/\/www.linuxdevops.cn\/2021\/05\/installing-docker-and-docker-compose-in-centos7\/\",\"name\":\"Centos7 \u5b89\u88c5docker \u548cdocker-compose - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\",\"isPartOf\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#website\"},\"datePublished\":\"2021-05-14T03:00:42+00:00\",\"dateModified\":\"2022-06-24T02:21:42+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/2021\/05\/installing-docker-and-docker-compose-in-centos7\/#breadcrumb\"},\"inLanguage\":\"zh-CN\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.linuxdevops.cn\/2021\/05\/installing-docker-and-docker-compose-in-centos7\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.linuxdevops.cn\/2021\/05\/installing-docker-and-docker-compose-in-centos7\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.linuxdevops.cn\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"kubernetes\",\"item\":\"https:\/\/www.linuxdevops.cn\/kubernetes\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Centos7 \u5b89\u88c5docker \u548cdocker-compose\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.linuxdevops.cn\/#website\",\"url\":\"https:\/\/www.linuxdevops.cn\/\",\"name\":\"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\",\"description\":\"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\u7b14\u8bb0\",\"publisher\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\"},\"alternateName\":\"linuxdevops\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.linuxdevops.cn\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-CN\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\",\"name\":\"\u7ba1\u7406\u5458\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-CN\",\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg\",\"contentUrl\":\"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg\",\"width\":512,\"height\":512,\"caption\":\"\u7ba1\u7406\u5458\"},\"logo\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/\"},\"description\":\"\u7ba1\u7406\u5458\",\"url\":\"https:\/\/www.linuxdevops.cn\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Centos7 \u5b89\u88c5docker \u548cdocker-compose - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.linuxdevops.cn\/2021\/05\/installing-docker-and-docker-compose-in-centos7\/","og_locale":"zh_CN","og_type":"article","og_title":"Centos7 \u5b89\u88c5docker \u548cdocker-compose - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","og_description":"## docker\u963f\u91cc\u4e91\u6e90 curl -o \/etc\/yum.repos.d\/docker-ce.repo h","og_url":"https:\/\/www.linuxdevops.cn\/2021\/05\/installing-docker-and-docker-compose-in-centos7\/","og_site_name":"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","article_published_time":"2021-05-14T03:00:42+00:00","article_modified_time":"2022-06-24T02:21:42+00:00","author":"\u7ba1\u7406\u5458","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.linuxdevops.cn\/2021\/05\/installing-docker-and-docker-compose-in-centos7\/#article","isPartOf":{"@id":"https:\/\/www.linuxdevops.cn\/2021\/05\/installing-docker-and-docker-compose-in-centos7\/"},"author":{"name":"\u7ba1\u7406\u5458","@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1"},"headline":"Centos7 \u5b89\u88c5docker \u548cdocker-compose","datePublished":"2021-05-14T03:00:42+00:00","dateModified":"2022-06-24T02:21:42+00:00","mainEntityOfPage":{"@id":"https:\/\/www.linuxdevops.cn\/2021\/05\/installing-docker-and-docker-compose-in-centos7\/"},"wordCount":3,"commentCount":0,"publisher":{"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1"},"articleSection":["Kubernetes","Linux"],"inLanguage":"zh-CN","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.linuxdevops.cn\/2021\/05\/installing-docker-and-docker-compose-in-centos7\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.linuxdevops.cn\/2021\/05\/installing-docker-and-docker-compose-in-centos7\/","url":"https:\/\/www.linuxdevops.cn\/2021\/05\/installing-docker-and-docker-compose-in-centos7\/","name":"Centos7 \u5b89\u88c5docker \u548cdocker-compose - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","isPartOf":{"@id":"https:\/\/www.linuxdevops.cn\/#website"},"datePublished":"2021-05-14T03:00:42+00:00","dateModified":"2022-06-24T02:21:42+00:00","breadcrumb":{"@id":"https:\/\/www.linuxdevops.cn\/2021\/05\/installing-docker-and-docker-compose-in-centos7\/#breadcrumb"},"inLanguage":"zh-CN","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.linuxdevops.cn\/2021\/05\/installing-docker-and-docker-compose-in-centos7\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.linuxdevops.cn\/2021\/05\/installing-docker-and-docker-compose-in-centos7\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.linuxdevops.cn\/"},{"@type":"ListItem","position":2,"name":"kubernetes","item":"https:\/\/www.linuxdevops.cn\/kubernetes\/"},{"@type":"ListItem","position":3,"name":"Centos7 \u5b89\u88c5docker \u548cdocker-compose"}]},{"@type":"WebSite","@id":"https:\/\/www.linuxdevops.cn\/#website","url":"https:\/\/www.linuxdevops.cn\/","name":"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","description":"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\u7b14\u8bb0","publisher":{"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1"},"alternateName":"linuxdevops","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.linuxdevops.cn\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-CN"},{"@type":["Person","Organization"],"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1","name":"\u7ba1\u7406\u5458","image":{"@type":"ImageObject","inLanguage":"zh-CN","@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/","url":"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg","contentUrl":"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg","width":512,"height":512,"caption":"\u7ba1\u7406\u5458"},"logo":{"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/"},"description":"\u7ba1\u7406\u5458","url":"https:\/\/www.linuxdevops.cn\/author\/root\/"}]}},"_links":{"self":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts\/1062"}],"collection":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/comments?post=1062"}],"version-history":[{"count":2,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts\/1062\/revisions"}],"predecessor-version":[{"id":1074,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts\/1062\/revisions\/1074"}],"wp:attachment":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/media?parent=1062"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/categories?post=1062"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/tags?post=1062"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}