wsl2 上的 docker 非常慢 [英] docker on wsl2 very slow

查看:33
本文介绍了wsl2 上的 docker 非常慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在阅读了在 wsl2 上运行 Docker 时的性能改进后,我一直在等待支持 wsl2 的 Windows 10 的正式版本.我更新了 Windows 和 Docker 并打开了 Docker 标志以使用 wsl2,并希望我的 Oracle 数据库在 Docker 容器中运行时获得一些性能提升,但不幸的是,这种变化大大降低了容器和我的笔记本电脑的速度.容器的性能大约慢了 10 倍,而且我的笔记本电脑在启动容器时几乎卡住了.似乎内存消耗将完全耗尽我的 8GB 并且大量内存交换开始发生.我可以做些什么来提高 Docker 在 wsl2 上的性能,或者至少可以更好地了解我的设置出了什么问题?

After having read about the performance improvements when running Docker on wsl2, I have been waiting for the official release of Windows 10 that supports wsl2. I updated Windows and Docker and switched on the Docker flag to use wsl2 and was hoping for some performance boost for my Oracle Database running in a Docker container but unfortunately the change slowed down the container and my laptop dramatically. The performance of the container is about 10x slower and my laptop is pretty much stuck when starting the container. It seems as if the memory consumption would completely use up my 8GB and heavy memory swapping starts to take place. Is there anything I can do to improve the performance of Docker on wsl2 or at least to better understand what's wrong in my setup?

我的环境:

  • 处理器 Intel(R) Core(TM) i7-2620M CPU @ 2.70GHz,2 核
  • 已安装的物理内存 (RAM) 8.00 GB
  • Microsoft Windows 10 专业版 10.0.19041 内部版本 19041
  • Docker 版本 19.03.8,构建 afacb8b

推荐答案

这来自于vmmem"这会消耗尽可能多的资源.要解决问题,只需转到您的用户文件对我来说

This comes from the "vmmem" which consumes as much resource as it can. To solve the problem just go to your user file for me in

C:用户用户名

在此目录中创建一个名为.wslconfig"的文件;您将在其中配置可以使用 WSL2 的资源数量:

In this directory create a file named ".wslconfig" in which you will configure how many resources can consume WSL2:

[wsl2] 
memory=900MB    #Limits VM memory in WSL 2 to 900MB 
processors=1    #Makes the WSL 2 VM use one virtual processors

现在关闭您的泊坞窗并等待vmmem"在任务管理器中关闭.

Now close your docker and wait for "vmmem" to close in the task manager.

然后您可以重新启动docker并正常vmmem"不会超过您设置的限制(此处为 900MB)如果不起作用,请重新启动计算机.

then You can restart docker and normally "vmmem" will not exceed the limit you have set (here 900MB) If don't work restart your computer.

希望对你有帮助.

这篇关于wsl2 上的 docker 非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆