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

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

问题描述

在了解了在wsl2上运行Docker时的性能改进之后,我一直在等待支持wsl2的Windows 10正式发行版.我更新了Windows和Docker,并打开Docker标志以使用wsl2,并希望提高运行在Docker容器中的Oracle数据库的性能,但是不幸的是,此更改大大降低了容器和笔记本电脑的速度.容器的性能大约慢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?

我的环境:

  • 处理器英特尔®酷睿TM i7-2620M CPU @ 2.70GHz,2核
  • 已安装的物理内存(RAM)8.00 GB
  • Microsoft Windows 10 Pro版本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:\ Users \ userName

C:\Users\userName

在此目录中,创建一个名为" .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.

希望它能对您有所帮助.

I hope it helped you.

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

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