在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

相关推荐
BranH2 分钟前
Linux系统中命令设定临时IP
linux·运维·服务器
极小狐13 分钟前
极狐GitLab 项目功能和权限解读
运维·git·安全·gitlab·极狐gitlab
宁酱醇14 分钟前
GitLab_密钥生成(SSH-key)
运维·ssh·gitlab
秋风起,再归来~20 分钟前
【Linux庖丁解牛】—进程优先级!
linux·运维·服务器
诡异森林。42 分钟前
Docker--Docker网络原理
网络·docker·容器
Lalolander1 小时前
设备制造行业如何避免项目管理混乱?
运维·制造·工程项目管理·四算一控·epc·环保设备工程·设备制造
ALex_zry1 小时前
Docker Macvlan网络配置实战:解决“network already exists“错误
网络·docker·php
IT小辉同学1 小时前
Docker如何更换镜像源提高拉取速度
spring cloud·docker·eureka
LucianaiB1 小时前
【金仓数据库征文】_AI 赋能数据库运维:金仓KES的智能化未来
运维·数据库·人工智能·金仓数据库 2025 征文·数据库平替用金仓
prinrf('千寻)1 小时前
nacos设置权重进行负载均衡不生效
运维·负载均衡