{"id":2267,"date":"2022-03-05T18:09:21","date_gmt":"2022-03-05T10:09:21","guid":{"rendered":"https:\/\/www.wjxy.net.cn\/?p=2267"},"modified":"2023-10-04T06:31:40","modified_gmt":"2023-10-03T22:31:40","slug":"proxmox-ve-%e4%b8%8b%e7%9a%84-lxc-%e5%85%a7%e8%b7%91-docker-ce","status":"publish","type":"post","link":"https:\/\/www.wjxy.net.cn\/?p=2267","title":{"rendered":"Proxmox VE \u4e0b\u7684 LXC \u5167\u8dd1 Docker-CE"},"content":{"rendered":"<p>Proxmox VE \u81ea\u5f9e 5.3 \u7248\u958b\u59cb\u5c31\u652f\u63f4\u4e86\u5de2\u72c0\u5f0f\u7684 container\uff0c\u4e5f\u5c31\u662f\u80fd\u5920\u5728 LXC \u5167\u8dd1 Docker\uff0c\u4e00\u76f4\u6c92\u53bb\u8a66\u5b83\uff0c\u9019\u5e7e\u5929\u5347\u7d1a\u4e86\u5bb6\u4e2d\u7684 Proxmox VE \u5230 5.4 \u7248\uff0c\u4e5f\u9806\u4fbf\u4f86\u6e2c\u8a66\u4e00\u4e0b\u3002<\/p>\n<h2>1. \u78ba\u8a8d Host \u6709 overlay \u53ca aufs \u8f09\u5165<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"atomic\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">root@pve1:~# lsmod | grep overlay\r\noverlay                77824  1\r\nroot@pve1:~# lsmod | grep aufs\r\naufs                  237568  0<\/pre>\n<p>\u5982\u679c\u6c92\u6709\u8f09\u5165\uff0c\u5fc5\u9808\u5c07\u4e0a\u8ff0\u5169\u500b\u6838\u5fc3\u6a21\u7d44\u65b0\u589e\u5230 \/etc\/modules\uff0c\u9019\u5169\u500b\u6838\u5fc3\u6a21\u7d44\u662f docker \u5fc5\u9808\u7684\u3002<\/p>\n<h2>2. LXC \u5efa\u7acb<\/h2>\n<p>\u9019\u908a\u6211\u4ee5 ubuntun 18.04 \u7248\u505a\u6e2c\u8a66\uff0c\u65bc Proxmox VE\u5148\u5efa\u7acb\u4e00\u500b ubuntu 18.04 \u7684 LXC\uff0c\u6ce8\u610f\u9019\u500b LXC \u5fc5\u9808\u662f unprivileged \u6a21\u5f0f\uff0c\u5982\u4e0b\u5716<\/p>\n<figure><\/figure>\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2270\" src=\"https:\/\/www.wjxy.net.cn\/wp-content\/uploads\/2022\/03\/proxmox-ve-\u4e0b\u7684-lxc-\u5167\u8dd1-docker-ce.png\" alt=\"\" width=\"695\" height=\"248\" srcset=\"https:\/\/www.wjxy.net.cn\/wp-content\/uploads\/2022\/03\/proxmox-ve-\u4e0b\u7684-lxc-\u5167\u8dd1-docker-ce.png 695w, https:\/\/www.wjxy.net.cn\/wp-content\/uploads\/2022\/03\/proxmox-ve-\u4e0b\u7684-lxc-\u5167\u8dd1-docker-ce-300x107.png 300w\" sizes=\"(max-width: 695px) 100vw, 695px\" \/><\/figure>\n<p>\u5b89\u88dd\u597d LXC \u4e4b\u5f8c\u5148\u4e0d\u8981\u6025\u8457\u555f\u52d5\uff0c\u63a5\u4e0b\u4f86\u5fc5\u9808\u8a2d\u5b9a\u9019\u500b LXC \u8981\u652f\u63f4\u5de2\u72c0\uff0c\u5982\u4e0b\u5716\uff0cOptions =&gt; Features =&gt; \u52fe\u9078 keyctl \u53ca nesting\u3002<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2271\" src=\"https:\/\/www.wjxy.net.cn\/wp-content\/uploads\/2022\/03\/proxmox-ve-\u4e0b\u7684-lxc-\u5167\u8dd1-docker-ce-1.png\" alt=\"\" width=\"700\" height=\"334\" srcset=\"https:\/\/www.wjxy.net.cn\/wp-content\/uploads\/2022\/03\/proxmox-ve-\u4e0b\u7684-lxc-\u5167\u8dd1-docker-ce-1.png 700w, https:\/\/www.wjxy.net.cn\/wp-content\/uploads\/2022\/03\/proxmox-ve-\u4e0b\u7684-lxc-\u5167\u8dd1-docker-ce-1-300x143.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure>\n<p>\u63a5\u8457\u5c31\u53ef\u4ee5\u555f\u52d5\u9019\u500b LXC\uff0c\u7136\u5f8c\u5c31\u9032\u5165 console \u6e96\u5099\u641e docker-ce \u4e86\u3002<\/p>\n<h2>3. \u5b89\u88dd\u53ca\u8a2d\u5b9a docker-ce<\/h2>\n<p>\u7167\u4e0b\u9762\u7684\u6b65\u9a5f\u5b89\u88dd\u5373\u53ef<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"atomic\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"false\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">apt update\r\napt upgrade\r\napt install gnupg2\r\napt install curl\r\napt install software-properties-common\r\ncurl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg | sudo apt-key add -\r\nadd-apt-repository \"deb [arch=amd64] https:\/\/download.docker.com\/linux\/ubuntu $(cat \/etc\/os-release | grep UBUNTU_CODENAME | cut -d '=' -f 2) stable\"\r\napt update\r\napt install docker-ce\r\n<\/pre>\n<h2>4. \u8a66\u8457\u8dd1\u770b\u770b<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"atomic\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"false\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">root@docker-test:~# docker run hello-world\r\nUnable to find image 'hello-world:latest' locally\r\nlatest: Pulling from library\/hello-world\r\n1b930d010525: Pull complete \r\nDigest: sha256:0e11c388b664df8a27a901dce21eb89f11d8292f7fca1b3e3c4321bf7897bffe\r\nStatus: Downloaded newer image for hello-world:latest\r\n\r\nHello from Docker!\r\nThis message shows that your installation appears to be working correctly.\r\n\r\nTo generate this message, Docker took the following steps:\r\n 1. The Docker client contacted the Docker daemon.\r\n 2. The Docker daemon pulled the \"hello-world\" image from the Docker Hub.\r\n    (amd64)\r\n 3. The Docker daemon created a new container from that image which runs the\r\n    executable that produces the output you are currently reading.\r\n 4. The Docker daemon streamed that output to the Docker client, which sent it\r\n    to your terminal.\r\n\r\nTo try something more ambitious, you can run an Ubuntu container with:\r\n $ docker run -it ubuntu bash\r\n\r\nShare images, automate workflows, and more with a free Docker ID:\r\n https:\/\/hub.docker.com\/\r\n\r\nFor more examples and ideas, visit:\r\n https:\/\/docs.docker.com\/get-started\/\r\n<\/pre>\n<p>\u54c7 !!!! \u6210\u529f\u4e86 \uff0c\u63a5\u8457\u8dd1\u53e6\u4e00\u6bb5\u9032\u5165 bash \u770b\u770b<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"atomic\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"false\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">root@docker-test:~# docker run -it ubuntu bash\r\nUnable to find image 'ubuntu:latest' locally\r\nlatest: Pulling from library\/ubuntu\r\n6abc03819f3e: Pull complete \r\n05731e63f211: Pull complete \r\n0bd67c50d6be: Pull complete \r\nDigest: sha256:f08638ec7ddc90065187e7eabdfac3c96e5ff0f6b2f1762cf31a4f49b53000a5\r\nStatus: Downloaded newer image for ubuntu:latest\r\nroot@d7ab5c80449f:\/# echo Hello\r\nHello\r\nroot@d7ab5c80449f:\/# exit\r\nexit\r\nroot@docker-test:~#<\/pre>\n<p>\u592a\u68d2\u4e86 ~~~ \u90fd\u53ef\u4ee5\u9806\u5229\u8dd1\uff0c\u7528 LXC \u8dd1 Docker \u7684\u597d\u8655\u986f\u800c\u6613\u898b! \u4e0d\u7528\u5efa\u7acb KVM \uff0c\u8d85\u7701\u8cc7\u6e90\uff0c\u5404\u4f4d\u53ef\u4ee5\u8a66\u8a66\u770b\u5594 !<\/p>\n<p>\u7531\u65bc Container \u5167\u8dd1 Docker \u6703\u6709\u5b89\u5168\u6027\u7684\u7591\u616e\uff0c\u6545\u6211\u5efa\u8b70\u9019\u7a2e\u65b9\u5f0f\u76ee\u524d\u4ecd\u6bd4\u8f03\u9069\u5408\u958b\u767c\u4e2d\u7684\u6e2c\u8a66\uff0c\u6216\u662f\u5167\u90e8\u7684\u81ea\u52d5\u6e2c\u8a66\uff0c\u6301\u7e8c\u6574\u5408\u4e5f\u53ef\u4ee5\u7528\u9019\u65b9\u6cd5\u90e8\u5c6c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Proxmox VE \u81ea\u5f9e 5.3 \u7248\u958b\u59cb\u5c31\u652f\u63f4\u4e86\u5de2\u72c0\u5f0f\u7684 container\uff0c\u4e5f\u5c31\u662f\u80fd\u5920\u5728 LXC \u5167\u8dd1 D [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[],"_links":{"self":[{"href":"https:\/\/www.wjxy.net.cn\/index.php?rest_route=\/wp\/v2\/posts\/2267"}],"collection":[{"href":"https:\/\/www.wjxy.net.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wjxy.net.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wjxy.net.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wjxy.net.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2267"}],"version-history":[{"count":2,"href":"https:\/\/www.wjxy.net.cn\/index.php?rest_route=\/wp\/v2\/posts\/2267\/revisions"}],"predecessor-version":[{"id":2273,"href":"https:\/\/www.wjxy.net.cn\/index.php?rest_route=\/wp\/v2\/posts\/2267\/revisions\/2273"}],"wp:attachment":[{"href":"https:\/\/www.wjxy.net.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wjxy.net.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wjxy.net.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}