{"id":3671,"date":"2024-05-09T13:10:17","date_gmt":"2024-05-09T05:10:17","guid":{"rendered":"https:\/\/www.aqwu.net\/wp\/?p=3671"},"modified":"2024-05-09T14:54:23","modified_gmt":"2024-05-09T06:54:23","slug":"windows-%e4%b8%8a%e7%9a%84-docker-desktop-wsl-2-%e5%90%8e%e7%ab%af","status":"publish","type":"post","link":"https:\/\/www.aqwu.net\/wp\/?p=3671","title":{"rendered":"WSL2 \u4f7f\u7528 Windows \u4e0a\u7684 Docker Desktop"},"content":{"rendered":"\n<p>\u9002\u7528\u4e8e Linux \u7684 Windows \u5b50\u7cfb\u7edf \uff08WSL\uff09 2 \u662f\u7531 Microsoft \u6784\u5efa\u7684\u5b8c\u6574 Linux \u5185\u6838\uff0c\u5b83\u5141\u8bb8 Linux \u53d1\u884c\u7248\u5728\u4e0d\u7ba1\u7406\u865a\u62df\u673a\u7684\u60c5\u51b5\u4e0b\u8fd0\u884c\u3002\u901a\u8fc7\u5728 WSL 2 \u4e0a\u8fd0\u884c Docker Desktop\uff0c\u7528\u6237\u53ef\u4ee5\u5229\u7528 Linux \u5de5\u4f5c\u533a\u5e76\u907f\u514d\u540c\u65f6\u7ef4\u62a4 Linux \u548c Windows \u751f\u6210\u811a\u672c\u3002\u6b64\u5916\uff0cWSL 2 \u8fd8\u6539\u8fdb\u4e86\u6587\u4ef6\u7cfb\u7edf\u5171\u4eab\u548c\u542f\u52a8\u65f6\u95f4\u3002<\/p>\n\n\n\n<p>Docker Desktop \u4f7f\u7528 WSL 2 \u4e2d\u7684\u52a8\u6001\u5185\u5b58\u5206\u914d\u529f\u80fd\u6765\u6539\u5584\u8d44\u6e90\u6d88\u8017\u3002\u8fd9\u610f\u5473\u7740 Docker Desktop \u4ec5\u4f7f\u7528\u6240\u9700\u7684 CPU \u548c\u5185\u5b58\u8d44\u6e90\u91cf\uff0c\u540c\u65f6\u5141\u8bb8 CPU \u548c\u5185\u5b58\u5bc6\u96c6\u578b\u4efb\u52a1\uff08\u5982\u6784\u5efa\u5bb9\u5668\uff09\u8fd0\u884c\u5f97\u66f4\u5feb\u3002<\/p>\n\n\n\n<p>\u6b64\u5916\uff0c\u4f7f\u7528 WSL 2\uff0c\u5728\u51b7\u542f\u52a8\u540e\u542f\u52a8 Docker \u5b88\u62a4\u7a0b\u5e8f\u6240\u9700\u7684\u65f6\u95f4\u8981\u5feb\u5f97\u591a\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>1. \u5148\u51b3\u6761\u4ef6<\/strong><\/h2>\n\n\n\n<p>\u5728\u6253\u5f00 Docker \u684c\u9762 WSL 2 \u529f\u80fd\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u5177\u6709\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u81f3\u5c11\u4e3a WSL \u7248\u672c 1.1.3.0.\uff0c\u4f46\u7406\u60f3\u60c5\u51b5\u4e0b\u662f\u6700\u65b0\u7248\u672c\u7684 WSL\uff0c<a href=\"https:\/\/docs.docker.com\/desktop\/wsl\/best-practices\/\">\u4ee5\u907f\u514d Docker Desktop \u65e0\u6cd5\u6309\u9884\u671f\u5de5\u4f5c<\/a>\u3002<\/li>\n\n\n\n<li>\u8ba4\u8bc6\u4e86\u9002\u7528\u4e8e Windows \u7684 Docker \u684c\u9762<a href=\"https:\/\/docs.docker.com\/desktop\/install\/windows-install\/#system-requirements\" target=\"_blank\" rel=\"noreferrer noopener\">\u7cfb\u7edf\u8981\u6c42<\/a>.<\/li>\n\n\n\n<li>\u5728 Windows \u4e0a\u5b89\u88c5\u4e86 WSL 2 \u529f\u80fd\u3002\u6709\u5173\u8be6\u7ec6\u8bf4\u660e\uff0c\u8bf7\u53c2\u9605<a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/wsl\/install-win10\" target=\"_blank\" rel=\"noreferrer noopener\">Microsoft \u6587\u6863<\/a>.<\/li>\n<\/ul>\n\n\n\n<p><strong>\u63d0\u793a<\/strong><\/p>\n\n\n\n<p>\u4e3a\u4e86\u83b7\u5f97\u66f4\u597d\u7684 WSL \u4f53\u9a8c\uff0c\u8bf7\u8003\u8651\u542f\u7528 WSL<a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/wsl\/wsl-config#experimental-settings\" target=\"_blank\" rel=\"noreferrer noopener\">autoMemory\u56de\u6536<\/a>\u81ea WSL 1.3.10\uff08\u5b9e\u9a8c\u6027\uff09\u8d77\u53ef\u7528\u7684\u8bbe\u7f6e\u3002<\/p>\n\n\n\n<p>\u6b64\u529f\u80fd\u589e\u5f3a\u4e86 Windows \u4e3b\u673a\u5728 WSL \u865a\u62df\u673a\u4e2d\u56de\u6536\u672a\u4f7f\u7528\u5185\u5b58\u7684\u80fd\u529b\uff0c\u4ece\u800c\u786e\u4fdd\u63d0\u9ad8\u5176\u4ed6\u4e3b\u673a\u5e94\u7528\u7a0b\u5e8f\u7684\u5185\u5b58\u53ef\u7528\u6027\u3002\u6b64\u529f\u80fd\u5bf9 Docker Desktop \u7279\u522b\u6709\u7528\uff0c\u56e0\u4e3a\u5b83\u53ef\u4ee5\u9632\u6b62 WSL VM \u5728 Docker \u5bb9\u5668\u6620\u50cf\u751f\u6210\u671f\u95f4\u5728 Linux \u5185\u6838\u7684\u9875\u9762\u7f13\u5b58\u4e2d\u4fdd\u7559\u5927\u91cf\u5185\u5b58\uff08\u4ee5 GB \u4e3a\u5355\u4f4d\uff09\uff0c\u800c\u4e0d\u4f1a\u5728 VM \u4e2d\u4e0d\u518d\u9700\u8981\u65f6\u5c06\u5176\u91ca\u653e\u56de\u4e3b\u673a\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"turn-on-docker-desktop-wsl-2\"><strong>2. \u6253\u5f00 Docker \u684c\u9762 WSL 2<\/strong><\/h2>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong>\u91cd\u8981<\/strong><\/p>\n\n\n\n<p>\u82e5\u8981\u907f\u514d\u5728 Docker Desktop \u4e0a\u4f7f\u7528 WSL 2 \u65f6\u51fa\u73b0\u4efb\u4f55\u6f5c\u5728\u51b2\u7a81\uff0c\u5fc5\u987b\u5728\u5b89\u88c5 Docker Desktop \u4e4b\u524d\u5378\u8f7d\u76f4\u63a5\u901a\u8fc7 Linux \u53d1\u884c\u7248\u5b89\u88c5\u7684\u4efb\u4f55\u4ee5\u524d\u7248\u672c\u7684 Docker \u5f15\u64ce\u548c CLI\u3002<\/p>\n<\/blockquote>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u4e0b\u8f7d\u5e76\u5b89\u88c5\u6700\u65b0\u7248\u672c\u7684<a href=\"https:\/\/desktop.docker.com\/win\/main\/amd64\/Docker%20Desktop%20Installer.exe\" target=\"_blank\" rel=\"noreferrer noopener\">\u9002\u7528\u4e8e Windows \u7684 Docker Desktop<\/a>.<\/li>\n\n\n\n<li>\u6309\u7167\u901a\u5e38\u7684\u5b89\u88c5\u8bf4\u660e\u5b89\u88c5 Docker Desktop\u3002\u6839\u636e\u4f60\u4f7f\u7528\u7684 Windows \u7248\u672c\uff0cDocker Desktop \u53ef\u80fd\u4f1a\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u63d0\u793a\u4f60\u6253\u5f00 WSL 2\u3002\u9605\u8bfb\u5c4f\u5e55\u4e0a\u663e\u793a\u7684\u4fe1\u606f\uff0c\u7136\u540e\u6253\u5f00 WSL 2 \u529f\u80fd\u4ee5\u7ee7\u7eed\u3002<\/li>\n\n\n\n<li>\u4ece&nbsp;<strong>Windows\u7684\u201c\u5f00\u59cb<\/strong>\u201d\u83dc\u5355\u542f\u52a8 Docker Desktop\u3002<\/li>\n\n\n\n<li>\u5bfc\u822a\u5230<strong> <strong>Settings<\/strong><\/strong>\u3002<\/li>\n\n\n\n<li>\u5728 <strong>General<\/strong> \u9009\u9879\u5361\u4e2d\uff0c\u9009\u62e9 <strong>Expose daemon on tcp:\/\/localhost:2375 without TLS<\/strong>\uff0c\u66b4\u9732  2375 \u7aef\u53e3<\/li>\n\n\n\n<li>\u5728 <strong>General<\/strong> \u9009\u9879\u5361\u4e2d\uff0c\u9009\u62e9 <strong>Use the WSL 2 based engine<\/strong> \u3002\u5982\u679c\u5df2\u5728\u652f\u6301 WSL 2 \u7684\u7cfb\u7edf\u4e0a\u5b89\u88c5\u4e86 Docker Desktop\uff0c\u5219\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4f1a\u6253\u5f00\u6b64\u9009\u9879\u3002<\/li>\n\n\n\n<li>\u9009\u62e9 <strong>Apply &amp; Restart<\/strong>\u3002<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"551\" src=\"https:\/\/www.aqwu.net\/wp\/wp-content\/uploads\/2024\/05\/\u56fe\u7247-10-1024x551.png\" alt=\"\" class=\"wp-image-3688\" srcset=\"https:\/\/www.aqwu.net\/wp\/wp-content\/uploads\/2024\/05\/\u56fe\u7247-10-1024x551.png 1024w, https:\/\/www.aqwu.net\/wp\/wp-content\/uploads\/2024\/05\/\u56fe\u7247-10-300x162.png 300w, https:\/\/www.aqwu.net\/wp\/wp-content\/uploads\/2024\/05\/\u56fe\u7247-10-768x414.png 768w, https:\/\/www.aqwu.net\/wp\/wp-content\/uploads\/2024\/05\/\u56fe\u7247-10-1536x827.png 1536w, https:\/\/www.aqwu.net\/wp\/wp-content\/uploads\/2024\/05\/\u56fe\u7247-10-2048x1103.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u73b0\u5728\uff0c<code>docker<\/code> \u547d\u4ee4\u53ef\u4ee5\u4f7f\u7528\u65b0\u7684 WSL 2 \u5f15\u64ce\u5728 Windows \u4e0a\u5de5\u4f5c\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"enabling-docker-support-in-wsl-2-distros\"><strong>3. \u5728 WSL 2 \u53d1\u884c\u7248\u4e2d\u542f\u7528 Docker \u652f\u6301<\/strong><\/h2>\n\n\n\n<p>WSL 2 \u5411 Windows \u6dfb\u52a0\u4e86\u5bf9\u201cLinux \u53d1\u884c\u7248\u201d\u7684\u652f\u6301\uff0c\u5176\u4e2d\u6bcf\u4e2a\u53d1\u884c\u7248\u7684\u884c\u4e3a\u90fd\u7c7b\u4f3c\u4e8e VM\uff0c\u4f46\u5b83\u4eec\u90fd\u8fd0\u884c\u5728\u5355\u4e2a\u5171\u4eab Linux \u5185\u6838\u4e4b\u4e0a\u3002<\/p>\n\n\n\n<p>Docker Desktop \u4e0d\u9700\u8981\u5b89\u88c5\u4efb\u4f55\u7279\u5b9a\u7684 Linux \u53d1\u884c\u7248\u3002<code>docker<\/code> CLI \u548c UI \u90fd\u53ef\u4ee5\u5728 Windows \u4e0a\u6b63\u5e38\u5de5\u4f5c\uff0c\u65e0\u9700\u4efb\u4f55\u5176\u4ed6 Linux \u53d1\u884c\u7248\u3002\u4f46\u662f\uff0c\u4e3a\u4e86\u83b7\u5f97\u6700\u4f73\u7684\u5f00\u53d1\u4eba\u5458\u4f53\u9a8c\uff0c\u6211\u4eec\u5efa\u8bae\u81f3\u5c11\u5b89\u88c5\u4e00\u4e2a\u989d\u5916\u7684\u53d1\u884c\u7248\u5e76\u542f\u7528 Docker \u652f\u6301\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u786e\u4fdd\u5206\u53d1\u5728 WSL 2 \u6a21\u5f0f\u4e0b\u8fd0\u884c\u3002WSL \u53ef\u4ee5\u5728 v1 \u6216 v2 \u6a21\u5f0f\u4e0b\u8fd0\u884c\u5206\u53d1\u3002\u82e5\u8981\u68c0\u67e5 WSL \u6a21\u5f0f\uff0c\u8bf7\u8fd0\u884c\uff1a\n<ul class=\"wp-block-list\">\n<li><code>wsl.exe -l -v <\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u8981\u5c06 Linux \u53d1\u884c\u7248\u5347\u7ea7\u5230 v2\uff0c\u8bf7\u8fd0\u884c\uff1a\n<ul class=\"wp-block-list\">\n<li><code>wsl.exe --set-version (distro name) 2 <\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u82e5\u8981\u5c06 v2 \u8bbe\u7f6e\u4e3a\u5c06\u6765\u5b89\u88c5\u7684\u9ed8\u8ba4\u7248\u672c\uff0c\u8bf7\u8fd0\u884c\uff1a\n<ul class=\"wp-block-list\">\n<li><code>wsl.exe --set-default-version 2<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Docker Desktop \u542f\u52a8\u540e\uff0c\u8f6c\u5230 <strong>Settings<\/strong> &gt; <strong>Resources<\/strong> &gt; <strong>WSL Integration<\/strong>\u3002\n<ul class=\"wp-block-list\">\n<li>Docker-WSL \u96c6\u6210\u5728\u9ed8\u8ba4 WSL \u5206\u53d1\u4e0a\u542f\u7528\uff0c\u5373<a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/wsl\/install\" target=\"_blank\" rel=\"noreferrer noopener\">Ubuntu\u7684<\/a>.\u82e5\u8981\u66f4\u6539\u9ed8\u8ba4 WSL \u53d1\u884c\u7248\uff0c\u8bf7\u8fd0\u884c\uff1a\n<ul class=\"wp-block-list\">\n<li><code>wsl --set-default &lt;distro name&gt;<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u9009\u62e9 <strong>Apply &amp; Restart<\/strong>\u3002<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"814\" src=\"https:\/\/www.aqwu.net\/wp\/wp-content\/uploads\/2024\/05\/\u56fe\u7247-9-1024x814.png\" alt=\"\" class=\"wp-image-3674\" srcset=\"https:\/\/www.aqwu.net\/wp\/wp-content\/uploads\/2024\/05\/\u56fe\u7247-9-1024x814.png 1024w, https:\/\/www.aqwu.net\/wp\/wp-content\/uploads\/2024\/05\/\u56fe\u7247-9-300x238.png 300w, https:\/\/www.aqwu.net\/wp\/wp-content\/uploads\/2024\/05\/\u56fe\u7247-9-768x610.png 768w, https:\/\/www.aqwu.net\/wp\/wp-content\/uploads\/2024\/05\/\u56fe\u7247-9-1536x1221.png 1536w, https:\/\/www.aqwu.net\/wp\/wp-content\/uploads\/2024\/05\/\u56fe\u7247-9.png 1968w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong>\u6ce8\u610f<\/strong><\/p>\n\n\n\n<p>Docker Desktop \u5b89\u88c5\u4e24\u4e2a\u4e13\u7528\u7684\u5185\u90e8 Linux \u53d1\u884c\u7248\u548c .\u7b2c\u4e00\u4e2a \uff08<code>docker-desktop<\/code>\uff09 \u7528\u4e8e\u8fd0\u884c Docker \u5f15\u64ce \uff08<code>docker-desktop<\/code>\uff09\uff0c\u800c\u7b2c\u4e8c\u4e2a \uff08<code>docker-desktop-data<\/code>\uff09 \u7528\u4e8e\u5b58\u50a8\u5bb9\u5668\u548c\u6620\u50cf\u3002\u4e24\u8005\u90fd\u4e0d\u80fd\u7528\u4e8e\u4e00\u822c\u5f00\u53d1\u3002<\/p>\n<\/blockquote>\n\n\n\n<p>\u539f\u6587\u94fe\u63a5\uff1a<a href=\"https:\/\/docs.docker.com\/desktop\/wsl\/\">Docker Desktop WSL 2 backend on Windows | Docker Docs<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>4. \u5728 WSL 2 \u4e2d\u5b89\u88c5\u548c\u914d\u7f6e Docker \u5ba2\u6237\u7aef<\/strong><\/h2>\n\n\n\n<p>\u6253\u5f00\u4f60\u7684 WSL 2 \u7ec8\u7aef\uff08\u6bd4\u5982 Ubuntu\uff09\u3002<br>\u4f60\u4e0d\u9700\u8981\u5b89\u88c5 Docker \u5f15\u64ce\uff0c\u56e0\u4e3a\u5b83\u5df2\u5728 Windows \u4e0a\u8fd0\u884c\u3002\u4f46\u4f60\u53ef\u80fd\u9700\u8981\u5b89\u88c5 Docker \u5ba2\u6237\u7aef\u4ee5\u4fbf\u4e8e\u5728 WSL 2 \u7ec8\u7aef\u4e2d\u7ba1\u7406\u5bb9\u5668\u3002<br>\u5b89\u88c5 Docker \u5ba2\u6237\u7aef\u7684\u547d\u4ee4\u901a\u5e38\u4e3a sudo apt install docker-ce-cli\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u5df2\u7ecf\u5b89\u88c5\u4e86\u5f15\u64ce\uff0c\u5219\u5148\u5378\u8f7d\u6240\u6709\uff0c\u518d\u91cd\u65b0\u5b89\u88c5\u5ba2\u6237\u7aef<\/p>\n\n\n\n<p>\u5148\u67e5\u8be2\u5b89\u88c5\u4e86\u54ea\u4e9b<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">dpkg -l | grep -i docker\nii  docker-compose                       1.29.2-1                                all          define and run multi-container Docker applications with YAML\nii  docker.io                            24.0.5-0ubuntu1~22.04.1                 amd64        Linux container runtime\nii  python3-docker                       5.0.3-1                                 all          Python 3 wrapper to access docker.io's control socket\nii  python3-dockerpty                    0.4.1-2                                 all          Pseudo-tty handler for docker Python client (Python 3.x)<\/pre><\/div>\n\n\n\n<p>\u5378\u8f7d<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">sudo apt-get purge docker.io docker-compose\nsudo apt-get purge python3-docker python3-dockerpty<\/pre><\/div>\n\n\n\n<p>\u91cd\u65b0\u5b89\u88c5 docker-ce-cli <\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">sudo apt-get update\nsudo apt-get upgreade\n\nsudo apt-get install \\\n    ca-certificates \\\n    curl \\\n    gnupg \\\n    lsb-release\ncurl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg | sudo gpg --dearmor -o \/usr\/share\/keyrings\/docker-archive-keyring.gpg\necho \\\n\"deb [arch=$(dpkg --print-architecture) signed-by=\/usr\/share\/keyrings\/docker-archive-keyring.gpg] https:\/\/download.docker.com\/linux\/ubuntu \\\n$(lsb_release -cs) stable\" | sudo tee \/etc\/apt\/sources.list.d\/docker.list &gt; \/dev\/null\nsudo apt-get update\nsudo apt-get install docker-ce-cli\n<\/pre><\/div>\n\n\n\n<p><br>\u4e3a\u4e86\u8ba9 Docker \u5ba2\u6237\u7aef\u5728 WSL 2 \u4e2d\u4e0e Windows \u7684 Docker Desktop \u901a\u4fe1\uff0c\u4f60\u9700\u8981\u786e\u4fdd WSL 2 \u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf DOCKER_HOST \u8bbf\u95ee Docker \u5f15\u64ce\u3002\u901a\u5e38\u8fd9\u662f\u81ea\u52a8\u914d\u7f6e\u7684\uff0c\u4f46\u5982\u679c\u9700\u8981\uff0c\u4f60\u53ef\u4ee5\u624b\u52a8\u6dfb\u52a0 export DOCKER_HOST=tcp:\/\/localhost:2375 \u5230\u4f60\u7684 ~\/.bashrc \u6216\u76f8\u5e94\u7684 shell \u914d\u7f6e\u6587\u4ef6\u4e2d\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:sh decode:true \">export DOCKER_HOST=tcp:\/\/localhost:2375<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>5. \u9a8c\u8bc1\u5b89\u88c5<\/strong><\/h2>\n\n\n\n<p>\u5728 WSL 2 \u7ec8\u7aef\u91cc\uff0c\u8fd0\u884c docker run hello-world\u3002\u8fd9\u5e94\u8be5\u80fd\u591f\u8fd0\u884c\u5e76\u663e\u793a\u4e00\u6761\u6d88\u606f\uff0c\u8bc1\u660e Docker \u5ba2\u6237\u7aef\u80fd\u591f\u901a\u8fc7 Docker Desktop on Windows \u63a7\u5236 Docker \u5bb9\u5668\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:sh decode:true \">docker run hello-world<\/pre><\/div>\n\n\n\n<p>\u5982\u679c\u6ca1\u6709\u542f\u52a8Widnows \u4e0b\u7684 Docker Desktop,\u5219\u4f1a\u663e\u793a\uff1a<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:sh decode:true \">docker run hello-world\ndocker: Get \"http:\/\/localhost:2375\/_ping\": dial tcp 127.0.0.1:2375: i\/o timeout.\nSee 'docker run --help'.<\/pre><\/div>\n\n\n\n<p>\u5982\u679c\u8fd0\u884c\u6210\u529f\uff0c\u5c31\u4f1a\u663e\u793a\u5982\u4e0b\uff1a<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:sh decode:true \">docker run hello-world\nUnable to find image 'hello-world:latest' locally\nlatest: Pulling from library\/hello-world\nc1ec31eb5944: Pull complete\nDigest: sha256:a26bff933ddc26d5cdf7faa98b4ae1e3ec20c4985e6f87ac0973052224d24302\nStatus: Downloaded newer image for hello-world:latest\n\nHello from Docker!\nThis message shows that your installation appears to be working correctly.\n\nTo generate this message, Docker took the following steps:\n 1. The Docker client contacted the Docker daemon.\n 2. The Docker daemon pulled the \"hello-world\" image from the Docker Hub.\n    (amd64)\n 3. The Docker daemon created a new container from that image which runs the\n    executable that produces the output you are currently reading.\n 4. The Docker daemon streamed that output to the Docker client, which sent it\n    to your terminal.\n\nTo try something more ambitious, you can run an Ubuntu container with:\n $ docker run -it ubuntu bash\n\nShare images, automate workflows, and more with a free Docker ID:\n https:\/\/hub.docker.com\/\n\nFor more examples and ideas, visit:\n https:\/\/docs.docker.com\/get-started\/\n<\/pre><\/div>\n\n\n\n<p>\u67e5\u770b Windows Desktop Containers \u4e0b\u9762\u4f1a\u6709 hello-world \u7684\u955c\u50cf<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"281\" src=\"https:\/\/www.aqwu.net\/wp\/wp-content\/uploads\/2024\/05\/\u56fe\u7247-11-1024x281.png\" alt=\"\" class=\"wp-image-3691\" srcset=\"https:\/\/www.aqwu.net\/wp\/wp-content\/uploads\/2024\/05\/\u56fe\u7247-11-1024x281.png 1024w, https:\/\/www.aqwu.net\/wp\/wp-content\/uploads\/2024\/05\/\u56fe\u7247-11-300x82.png 300w, https:\/\/www.aqwu.net\/wp\/wp-content\/uploads\/2024\/05\/\u56fe\u7247-11-768x211.png 768w, https:\/\/www.aqwu.net\/wp\/wp-content\/uploads\/2024\/05\/\u56fe\u7247-11-1536x422.png 1536w, https:\/\/www.aqwu.net\/wp\/wp-content\/uploads\/2024\/05\/\u56fe\u7247-11-2048x563.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u9002\u7528\u4e8e Linux \u7684 Windows \u5b50\u7cfb\u7edf \uff08WSL\uff09 2 \u662f\u7531 Microsoft \u6784\u5efa\u7684\u5b8c\u6574 Linu [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[444,58],"tags":[457,394],"class_list":["post-3671","post","type-post","status-publish","format-standard","hentry","category-ai","category-windows","tag-docker-desktop","tag-wsl2"],"views":3142,"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=\/wp\/v2\/posts\/3671","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3671"}],"version-history":[{"count":16,"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=\/wp\/v2\/posts\/3671\/revisions"}],"predecessor-version":[{"id":3694,"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=\/wp\/v2\/posts\/3671\/revisions\/3694"}],"wp:attachment":[{"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3671"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3671"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3671"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}