欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 汽车 > 时评 > 在Windows10下安装Docker WSL 2 桌面版

在Windows10下安装Docker WSL 2 桌面版

2025/2/24 22:14:31 来源:https://blog.csdn.net/skywalk8163/article/details/144708244  浏览:    关键词:在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 

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词