在Windows10下安装Docker WSL 2 桌面版

在windows10的wsl下,需要windows启动docker服务器。

Docker官网介绍

Docker Desktop WSL 2 backend on Windows

Windows Subsystem for Linux (WSL) 2 is a full Linux kernel built by Microsoft, which lets Linux distributions run without managing virtual machines. With Docker Desktop running on WSL 2, users can leverage Linux workspaces and avoid maintaining both Linux and Windows build scripts. In addition, WSL 2 provides improvements to file system sharing and boot time.

Docker Desktop uses the dynamic memory allocation feature in WSL 2 to improve the resource consumption. This means Docker Desktop only uses the required amount of CPU and memory resources it needs, while allowing CPU and memory-intensive tasks such as building a container, to run much faster.

Additionally, with WSL 2, the time required to start a Docker daemon after a cold start is significantly faster.

Turn on Docker Desktop WSL 2

Important

To avoid any potential conflicts with using WSL 2 on Docker Desktop, you must uninstall any previous versions of Docker Engine and CLI installed directly through Linux distributions before installing Docker Desktop.

  1. Download and install the latest version of Docker Desktop for Windows.

  2. Follow the usual installation instructions to install Docker Desktop. Depending on which version of Windows you are using, Docker Desktop may prompt you to turn on WSL 2 during installation. Read the information displayed on the screen and turn on the WSL 2 feature to continue.

  3. Start Docker Desktop from the Windows Start menu.

  4. Navigate to Settings.

  5. From the General tab, select Use WSL 2 based engine..

    If you have installed Docker Desktop on a system that supports WSL 2, this option is turned on by default.

  6. Select Apply & Restart.

Install Docker Desktop on Windows

Tip

See the FAQs on how to install and run Docker Desktop without needing administrator privileges.

Install interactively

  1. Download the installer using the download button at the top of the page, or from the release notes.

  2. Double-click Docker Desktop Installer.exe to run the installer. By default, Docker Desktop is installed at C:\Program Files\Docker\Docker.

  3. When prompted, ensure the Use WSL 2 instead of Hyper-V option on the Configuration page is selected or not depending on your choice of backend.

    If your system only supports one of the two options, you won't be able to select which backend to use.

  4. Follow the instructions on the installation wizard to authorize the installer and proceed with the install.

  5. When the installation is successful, select Close to complete the installation process.

  6. Start Docker Desktop.

If your administrator account is different to your user account, you must add the user to the docker-users group:

  1. Run Computer Management as an administrator.
  2. Navigate to Local Users and Groups > Groups > docker-users.
  3. Right-click to add the user to the group.
  4. Sign out and sign back in for the changes to take effect.

实践

安装docker

下载软件:Windows | Docker Docs

双击文件Double-click Docker Desktop Installer.exe 安装

安装中选项,选择 Use WSL 2 而不是 Hyper-V option

后面就是按部就班的安装

如果有老版本的话,它会问你是否升级到新版本,选是的

最后安装好后,它会要求重启。这里要提醒下,习惯了FreeBSD、Linux或者Mac OS的用户可能会习惯性的点击了"同意",那么系统就会立刻重启,如果有什么工作没有保存,可就后悔莫及了。

总体来说,Windows下的安装还是那么简洁方便,只要找到正确的安装程序,那么后面很大程度就是一路"yes"或者"同意",

启动docker

点击图标启动

配置

进入"settings" 点Resource ,选择"Enable integration with my default WSL distro"

因为还手工安装了Ubuntu24.04,所以

同时选中"Enable integration with additional distros:" ,选中里面的Ubuntu24.04

最后点击"Apply and restart"

开始使用

查找需要的系统

查找busybox

复制代码
docker search register.liberx.info/busybox

查找riscv64系统

复制代码
C:\Users\Admin> docker search register.liberx.info/riscv64

查找飞桨

复制代码
C:\Users\Admin> docker search register.liberx.info/paddle
NAME                    DESCRIPTION                          STARS     OFFICIAL
pengbaolin/paddle                                            0
paddlepaddle/paddle     PArallel Distributed Deep LEarning   126
o0o0o/paddle            just for test                        0
haidee/paddle           paddle images                        0
pangyoki/paddle                                              0
zhangrunjiang/paddle                                         0
louishp/paddle          paddle                               0
chengduozh/paddle                                            1
wadefelix/paddle        Paddle Images                        0
tianshuo78520a/paddle                                        0
sidgoyal78/paddle                                            0
qili93/paddle                                                0
shiertier/paddle                                             0
yancey1989/paddle                                            0
vikings/paddle                                               0
nuroedu/paddle                                               0
paddlepaddlece/paddle                                        0
mingtop/paddle          paddle, baidu                        0
wjf8882300/paddle                                            0
opper2022/paddle                                             0
drinkcode/paddle        for dev                              0
helinwang/paddle                                             0
sneaxiy/paddle                                               0
parl/paddle                                                  0
zhengqiwen/paddle                                            0

pull下载系统

下载riscv64位ubuntu

复制代码
docker pull riscv64/ubuntu

这个失败....

下载飞桨

复制代码
C:\Users\Admin> docker pull paddlepaddle/paddle

速度很慢

调试

启动后报错,且发现Ubuntu无法启动

后来重启了Docker,就没有报错了

win10下的Ubuntu在windows重启后无法启动

这也太奇怪了,安装docker重启系统后,Windows10里的Ubuntu无法启动了。 以前也碰到过这种问题,是不是Ubuntu没有关闭,就Windows关机导致的?

到Windows软件商店里,Ubuntu22.04重新安装后,点返回,再进入Ubuntu22.04应用界面,点击启动,ok了(直接点重装再点启动,启动还是会失败的)

同样处理Ubuntu24.04

相关推荐
志栋智能4 小时前
低成本自动化巡检:7×24小时守护业务稳定
运维·网络·自动化
AI自动化工坊4 小时前
DeerFlow 2.0实战指南:生产级AI Agent框架的Docker化部署与并行编排
人工智能·docker·ai·容器·开源
ToB营销学堂4 小时前
MarketUP | B2B 自动化营销实战:如何打破“营-销”数据孤岛,构建高转化线索流?
运维·自动化
CDN3605 小时前
360CDN 全系列产品体验:CDN / 高防 / SDK 游戏盾横向测评
运维·安全·游戏
行者-全栈开发6 小时前
容器化时代来临 - Docker 技术演进与核心价值
运维·docker·容器·cicd·自动化构建·容器化时代
云飞云共享云桌面6 小时前
非标自动化研发成本高?云飞云共享云桌面:1台主机=10台工作站,年省数十万。
大数据·运维·服务器·人工智能·自动化·云计算·电脑
AI自动化工坊6 小时前
GitAgent实战解析:用Docker思想解决AI Agent框架碎片化问题,降低80%迁移成本
人工智能·docker·ai·容器·开源
chehaoman6 小时前
Failed to restart nginx.service Unit nginx.service not found
运维·nginx
Linux运维技术栈6 小时前
生产环境Linux应用目录迁移至LVM独立分区 标准化实战方案
linux·运维·服务器·lvm·逻辑卷
feasibility.7 小时前
SSH Agent Forwarding 与 tmux 排障笔记
linux·运维·服务器·经验分享·笔记·ssh