{"id":3430,"date":"2023-09-10T11:25:24","date_gmt":"2023-09-10T03:25:24","guid":{"rendered":"http:\/\/www.yuguoxy.com\/geekhome\/?p=3430"},"modified":"2023-10-10T11:52:35","modified_gmt":"2023-10-10T03:52:35","slug":"wsl2%e5%ae%89%e8%a3%85centos7","status":"publish","type":"post","link":"https:\/\/ai.zhousir.top\/?p=3430","title":{"rendered":"Wsl2\u5b89\u88c5CentOS7"},"content":{"rendered":"<h4>1.<a title=\"\u8be6\u7ec6\u9605\u8bfb Wsl2\u5b89\u88c5CentOS7\" href=\"https:\/\/ai.zhousir.top\/archives\/3430\">Wsl2\u5b89\u88c5CentOS7<\/a><\/h4>\n<h4>2.<a title=\"\u8be6\u7ec6\u9605\u8bfb Docker \u7b80\u4ecb\u548c\u5b89\u88c5\" href=\"https:\/\/ai.zhousir.top\/archives\/3419\">Docker \u7b80\u4ecb\u548c\u5b89\u88c5<\/a><\/h4>\n<h4>3.<a title=\"\u8be6\u7ec6\u9605\u8bfb Docker \u5feb\u901f\u5b89\u88c5\u8f6f\u4ef6\" href=\"https:\/\/ai.zhousir.top\/archives\/3434\">Docker \u5feb\u901f\u5b89\u88c5\u8f6f\u4ef6<\/a><\/h4>\n<h4>4.<a title=\"\u8be6\u7ec6\u9605\u8bfb \u5236\u4f5c\u81ea\u5df1\u7684\u955c\u50cf\" href=\"https:\/\/ai.zhousir.top\/archives\/3447\">\u5236\u4f5c\u81ea\u5df1\u7684\u955c\u50cf<\/a><\/h4>\n<h4>5.<a title=\"\u8be6\u7ec6\u9605\u8bfb Docker-Compose\u53d1\u5e03\u4e0e\u90e8\u7f72\" href=\"https:\/\/ai.zhousir.top\/archives\/3450\">Docker-Compose\u53d1\u5e03\u4e0e\u90e8\u7f72<\/a><\/h4>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2023\/10\/Snipaste_2023-10-10_11-33-14.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-3439\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2023\/10\/Snipaste_2023-10-10_11-33-14.png\" alt=\"Snipaste_2023-10-10_11-33-14\" width=\"278\" height=\"171\" \/><\/a><\/p>\n<blockquote><p><span class=\"md-line md-end-block\" contenteditable=\"true\">WSL\uff08Windows Subsystem for Linux\uff09\u53ef\u4ee5\u8ba9\u7528\u6237\u5728\u5728 Windows \u4e0b\u4f53\u9a8c Linux \u7cfb\u7edf <\/span><\/p>\n<p><span class=\"md-line md-end-block\" contenteditable=\"true\">Wsl2\u5b89\u88c5CentOS7 \u524d\u63d0\u6761\u4ef6\uff1a\u5b89\u88c5\u4e86\u865a\u62df\u673a\uff0c\u4e14\u5b89\u88c5\u597d\u4e86Docker<\/span><\/p><\/blockquote>\n<ol class=\"ol-list\" start=\"\">\n<li class=\"md-list-item\">\n<p contenteditable=\"true\"><span class=\"md-line md-end-block\" contenteditable=\"true\">\u627e\u5230\u4f60\u60f3\u8981\u7684CentOS\u7248\u672c <span class=\"\"><a spellcheck=\"false\" href=\"https:\/\/hub.docker.com\/_\/centos?tab=tags&amp;page=1&amp;ordering=last_updated\">CentOS\u7684DockerHub\u5730\u5740<\/a><\/span><\/span><\/p>\n<\/li>\n<li class=\"md-list-item\">\n<p contenteditable=\"true\"><span class=\"md-line md-end-block\" contenteditable=\"true\">\u4e0b\u8f7ddocker\u955c\u50cf\uff08\u6211\u8fd9\u91cc\u662f\u56e0\u4e3a\u5df2\u7ecf\u4e0b\u8f7d\u597d\u4e86\uff0c\u6240\u4ee5\u663e\u793a\u7684\u7ed3\u679c\u662f\u8fd9\u6837\uff09<\/span><\/p>\n<pre class=\"md-fences md-end-block\" lang=\"\" contenteditable=\"false\">[root@localhost128 ~]# docker pull centos:centos7\r\ncentos7: Pulling from library\/centos\r\nDigest: sha256:0f4ec88e21daf75124b8a9e5ca03c37a5e937e0e108a255d890492430789b60e\r\nStatus: Image is up to date for centos:centos7\r\ndocker.io\/library\/centos:centos7<\/pre>\n<\/li>\n<li class=\"md-list-item\">\n<p contenteditable=\"true\"><span class=\"md-line md-end-block\" contenteditable=\"true\">\u67e5\u770b\u5df2\u7ecf\u4e0b\u8f7d\u597d\u7684\u955c\u50cf<\/span><\/p>\n<pre class=\"md-fences md-end-block\" lang=\"\" contenteditable=\"false\">[root@localhost128 ~]# docker images\r\nREPOSITORY \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 TAG \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 IMAGE ID \u00a0 \u00a0 \u00a0 CREATED \u00a0 \u00a0 \u00a0 \u00a0 SIZE\r\ncentos \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 centos7 \u00a0 \u00a0 \u00a0 \u00a0 8652b9f0cb4c \u00a0 9 months ago \u00a0  204MB<\/pre>\n<\/li>\n<li class=\"md-list-item\">\n<p contenteditable=\"true\"><span class=\"md-line md-end-block\" contenteditable=\"true\">\u542f\u52a8centos\u5e76\u67e5\u770b\u542f\u52a8\u540e\u7684\u5bb9\u5668<\/span><\/p>\n<pre class=\"md-fences md-end-block\" lang=\"\" contenteditable=\"false\">[root@localhost128 ~]# docker run centos:centos7\r\n[root@localhost128 ~]# docker ps -a\r\nCONTAINER ID \u00a0 IMAGE \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  COMMAND \u00a0 \u00a0 \u00a0 CREATED \u00a0 \u00a0 \u00a0 \u00a0 STATUS \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\r\n44604d80ea3a \u00a0 centos:centos7 \u00a0 \"\/bin\/bash\" \u00a0 9 seconds ago \u00a0 Exited (0) 7 seconds ago<\/pre>\n<\/li>\n<li class=\"md-list-item\">\n<p contenteditable=\"true\"><span class=\"md-line md-end-block\" contenteditable=\"true\">\u5bfc\u51fa\u521a\u521a\u542f\u52a8\u7684\u5bb9\u5668<\/span><\/p>\n<pre class=\"md-fences md-end-block\" lang=\"\" contenteditable=\"false\">[root@localhost128 ~]# docker export 44604d80ea3a &gt;  centos7.tar\r\n[root@localhost128 ~]# ls\r\nanaconda-ks.cfg  centos7.tar<\/pre>\n<\/li>\n<li class=\"md-list-item\">\n<p contenteditable=\"true\"><span class=\"md-line md-end-block\" contenteditable=\"true\">\u628a\u521a\u521a\u5bfc\u51fa\u7684\u5bb9\u5668\u4e0b\u8f7d\u5230\u672c\u5730\u7535\u8111\u4e0a<\/span><\/p>\n<p contenteditable=\"true\"><span class=\"md-line md-end-block\" contenteditable=\"true\"><span class=\"md-image md-img-loaded\" contenteditable=\"false\" data-src=\".\/media\/1695904454259.png\"><img decoding=\"async\" src=\"file:\/\/D:\/course\/docker\/media\/1695904454259.png?lastModify=1696908226\" alt=\"\" data-local-refresh=\"true\" \/><\/span><\/span><\/p>\n<\/li>\n<li class=\"md-list-item\">\n<p contenteditable=\"true\"><span class=\"md-line md-end-block\" contenteditable=\"true\">\u5b89\u88c5\u521a\u521a\u5bfc\u51fa\u7684CentOS7 <span class=\"\"><a spellcheck=\"false\" href=\"https:\/\/docs.microsoft.com\/zh-cn\/windows\/wsl\/reference\">Wsl2\u547d\u4ee4\u6587\u6863<\/a><\/span><\/span><\/p>\n<pre class=\"md-fences md-end-block\" lang=\"\" contenteditable=\"false\">wsl --import  centos7  D:\\Linux\\CentOS7 \u00a0 D:\\Linux\\centos7.tar<\/pre>\n<p contenteditable=\"true\"><span class=\"md-line md-end-block\" contenteditable=\"true\"><span class=\"md-image md-img-loaded\" contenteditable=\"false\" data-src=\".\/media\/1695904485269.png\"><img decoding=\"async\" src=\"file:\/\/D:\/course\/docker\/media\/1695904485269.png?lastModify=1696908226\" alt=\"\" data-local-refresh=\"true\" \/><\/span><\/span><\/p>\n<\/li>\n<li class=\"md-list-item\">\n<p contenteditable=\"true\"><span class=\"md-line md-end-block\" contenteditable=\"true\">\u8bbe\u7f6e\u9ed8\u8ba4\u7248\u672c<\/span><\/p>\n<pre class=\"md-fences md-end-block\" lang=\"\" contenteditable=\"false\">PS C:\\WINDOWS\\system32&gt; wsl -l\r\n\u9002\u7528\u4e8e Linux \u7684 Windows \u5b50\u7cfb\u7edf\u5206\u53d1\u7248:\r\ndocker-desktop (\u9ed8\u8ba4)\r\ncentos7\r\ndocker-desktop-data\r\n\u200b\r\n\u547d\u4ee4\uff1a wsl --set-default &lt;Distribution Name&gt;\r\n$&gt;wsl --set-default centos7\r\n\u200b\r\nPS C:\\WINDOWS\\system32&gt; wsl -l -v\r\n  NAME \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 STATE \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 VERSION\r\n* centos7 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  Running \u00a0 \u00a0 \u00a0 \u00a0 2\r\n  docker-desktop \u00a0 \u00a0 \u00a0 \u00a0 Running \u00a0 \u00a0 \u00a0 \u00a0 2\r\n  docker-desktop-data \u00a0  Running \u00a0 \u00a0 \u00a0 \u00a0 2<\/pre>\n<\/li>\n<li class=\"md-list-item\">\n<h2 class=\"md-end-block md-heading\" contenteditable=\"true\">\u7ec8\u6b62\u6307\u5b9a\u7684\u53d1\u884c\u7248\u6216\u963b\u6b62\u5176\u8fd0\u884c<\/h2>\n<p contenteditable=\"true\"><span class=\"md-line md-end-block\" contenteditable=\"true\">\u8bed\u6cd5: wsl &#8211;terminate <span class=\"md-tag\" spellcheck=\"false\">&lt;Distribution Name&gt;<\/span><\/span><\/p>\n<pre class=\"md-fences md-end-block\" lang=\"\" contenteditable=\"false\">PS C:\\Users\\HUAWEI&gt; wsl --terminate docker-desktop\r\nPS C:\\Users\\HUAWEI&gt; wsl --terminate docker-desktop-data \r\nPS C:\\Users\\HUAWEI&gt; wsl -l -v\r\n  NAME \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  STATE \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 VERSION\r\n* centos7 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  Running \u00a0 \u00a0 \u00a0 \u00a0 2\r\n  docker-desktop \u00a0 \u00a0 \u00a0 \u00a0 Stopped \u00a0 \u00a0 \u00a0 \u00a0 2\r\n  docker-desktop-data \u00a0  Stopped \u00a0 \u00a0 \u00a0 \u00a0 2<\/pre>\n<p contenteditable=\"true\"><span class=\"md-line md-end-block\" contenteditable=\"true\">\u82e5\u8981\u7ec8\u6b62\u6307\u5b9a\u7684\u53d1\u884c\u7248\u6216\u963b\u6b62\u5176\u8fd0\u884c\uff0c\u8bf7\u5c06 <span spellcheck=\"false\"><code>&lt;Distribution Name&gt;<\/code><\/span> \u66ff\u6362\u4e3a\u76ee\u6807\u53d1\u884c\u7248\u7684\u540d\u79f0\u3002<\/span><\/p>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>1.Wsl2\u5b89\u88c5CentOS7 2.Docker \u7b80\u4ecb\u548c\u5b89\u88c5 3.Docker \u5feb\u901f\u5b89\u88c5\u8f6f\u4ef6 4.\u5236\u4f5c\u81ea\u5df1\u7684\u955c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[105],"tags":[160,159],"_links":{"self":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/3430"}],"collection":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3430"}],"version-history":[{"count":5,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/3430\/revisions"}],"predecessor-version":[{"id":3459,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/3430\/revisions\/3459"}],"wp:attachment":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3430"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3430"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}