在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

相关推荐
热爱编程的小白白5 分钟前
【Playwright自动化】录制生成脚本
运维·自动化
java_logo14 分钟前
MySQL Server Docker 容器化部署指南
linux·运维·数据库·docker·容器
I***t71624 分钟前
自己编译RustDesk,并将自建ID服务器和key信息写入客户端
运维·服务器
BJ_Bonree29 分钟前
数智先锋 | 核心应用响应时常<1s、多终端崩溃率低至 0.1%!Bonree ONE 赋能蓝月亮应用性能与终端体验双重升级!
运维
Radan小哥30 分钟前
Docker学习笔记—day0010
笔记·学习·docker
张鱼小丸子35 分钟前
电脑刷机教程:轻松重装系统指南
运维
e***193538 分钟前
docker compose安装redis
redis·docker·容器
k***19540 分钟前
Nginx反向代理出现502 Bad Gateway问题的解决方案
运维·nginx·gateway
可爱又迷人的反派角色“yang”43 分钟前
LVS+Keepalived群集
linux·运维·服务器·前端·nginx·lvs