在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

相关推荐
T.O.P119 分钟前
Docker实战
java·spring cloud·docker
几道之旅12 分钟前
GraphRAG实践:docker部署neo4j
docker·容器·neo4j
admin_23318 分钟前
k8s集群,CRI-Docker部署条件及方法
docker·容器·kubernetes
admin_23324 分钟前
k8s修改存储目录-介绍
云原生·容器·kubernetes
what_201824 分钟前
Docker和K8s关系
docker·容器·kubernetes
裁二尺秋风25 分钟前
k8s基础(4)—Kubernetes-Service
云原生·容器·kubernetes
古人诚不我欺32 分钟前
K8s高可用集群之Kubernetes集群管理平台、命令补全工具、资源监控工具部署、常用命令
云原生·容器·kubernetes
tan6257471 小时前
github
运维
鹧鸪云光伏与储能软件开发1 小时前
鹧鸪云运维软件焕新升级
运维·光伏运维
woshiabc1111 小时前
宝塔docker安装milvus向量库
docker·容器·milvus