Docker 无法在 Windows 上启动:没有足够的内存来启动 docker
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/43170089/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Docker won't start on Windows: Not Enough memory to start docker
提问by George Edwards
I am trying to get started with Docker on Windows. My machine has 4GB of RAM and a 1.9GHz - 2.5GHz Intel i5 processor, running Windows 10 Pro x64. I know these aren't powerful specs, but I would have thought I should be able to run Docker?
我正在尝试在 Windows 上开始使用 Docker。我的机器有 4GB 内存和 1.9GHz - 2.5GHz Intel i5 处理器,运行 Windows 10 Pro x64。我知道这些不是强大的规范,但我认为我应该能够运行 Docker?
However, having downloaded Docker, I get the error message:
但是,下载 Docker 后,我收到错误消息:
Not Enough memory to start docker
没有足够的内存来启动 docker
I have seen various forum posts and github issues about this and followed all the advice I can see, such as modifying the settings in Docker, I tried these:
我看过有关此的各种论坛帖子和 github 问题,并遵循了我能看到的所有建议,例如修改 Docker 中的设置,我尝试了这些:
They also mentioned changing the settings of the Hyper-V VM however, this seems to be deleted and recreated with the Docker specified settings on every attempted launch. I tried 2048MB, 1792MB, 1536MB, 1280MB and 1024MB of RAM, all of which failed.
他们还提到了更改 Hyper-V 虚拟机的设置,但是,这似乎被删除并在每次尝试启动时使用 Docker 指定的设置重新创建。我尝试了 2048MB、1792MB、1536MB、1280MB 和 1024MB 的 RAM,但都失败了。
What else can I do? Surely I can run docker in some form on my machine? NB: I have closed all non-essential background apps. There doesn't seem to be many other suggestions for what seems to be a fairly common issue, where the given solutions don't work?
我还可以做些什么?我当然可以在我的机器上以某种形式运行 docker 吗?注意:我已经关闭了所有非必要的后台应用程序。对于似乎相当普遍的问题,给定的解决方案不起作用,似乎没有很多其他建议?
回答by rbashish
I have also encountered the same problem. Tried everything from giving dynamic memory to enabling and disabling Hyper V and many more. But with all that, I got no success.
我也遇到了同样的问题。尝试了从提供动态内存到启用和禁用 Hyper V 等等的所有方法。但尽管如此,我还是没有成功。
Then I tried these steps for
然后我尝试了这些步骤
Docker won't start on Windows: Not Enough memory to start docker:
Docker 不会在 Windows 上启动:没有足够的内存来启动 docker:
1) From System Tray menu, right click on Dockericon
1) 从系统托盘菜单中,右键单击Docker图标
2) Select Switch to Windows containers...
2) 选择切换到 Windows 容器...
3) Restartthe system.
3)重新启动系统。
There you go after restarting your docker status should be showing as: Docker is running
重启后你的 docker 状态应该显示为:Docker is running
Hope this helps!
希望这可以帮助!
PS: Switching back to Linux container should work now after switching to Windows Containers for most of the users as said by rfay.
PS:如 rfay 所说,对于大多数用户切换回 Windows 容器后,现在应该可以切换回 Linux 容器了。
Updates (May 01, 2019)
更新(2019 年 5 月 1 日)
Despite of the above methods if you're still unable to start docker on your Windows Machine, try with the following things:
尽管采用了上述方法,如果您仍然无法在 Windows 机器上启动 docker,请尝试以下操作:
- Download RAMMapfrom Microsoft's Official website
- Open the application and select Emptymenu
- From the sub-menu list select the first option Empty Working Sets
- Now refresh it by pressing
F5
- 从微软官网下载 RAMMap
- 打开应用程序并选择空菜单
- 从子菜单列表中选择第一个选项Empty Working Sets
- 现在按下刷新它
F5
Now try running docker and I believe this should work. Good Luck!
现在尝试运行 docker,我相信这应该可以工作。祝你好运!
回答by STREET MONEY
I solved this issue by right clicking on the docker tray icon chose settings and then tapped on the "Advanced" section.
我通过右键单击泊坞窗托盘图标选择设置,然后点击“高级”部分解决了这个问题。
Then I lowered the memory from the default 2048 to 1536 and works like charm. Another option is try to switch to Windows Containers then Restart the Machine and switch back to Linux Containers.
然后我将内存从默认的 2048 降低到 1536 并像魅力一样工作。另一种选择是尝试切换到 Windows Containers,然后重新启动机器并切换回 Linux Containers。
Below is my docker settings with Advanced tab open. Note the Memory is 1536 and My laptop has 4GB Ram.
下面是我打开高级选项卡的 docker 设置。请注意内存是 1536,我的笔记本电脑有 4GB 内存。
Also the virtual machine "MobyLinuxVM" is running as shown below;
虚拟机“MobyLinuxVM”也在运行,如下所示;
I hope this helps someone one day even if was a late answer :)
我希望这对某人有帮助,即使是迟到的答案:)
回答by Gurvinder singh
In Settings, I did a reset to factory defaults. And restarted the laptop. It Worked for me
在设置中,我重置为出厂默认设置。并重新启动了笔记本电脑。它对我有用
回答by Mohit
if you are on window and got this error, Go to Search box
如果您在窗口上并收到此错误,请转到搜索框
#1 type Hyper-V Manager
Click on it,
a window like attached screenshot open,
#2 Select MobilinuxVM(normally same name if running windows docker)
#3 Right click and open - Setting
2 The second window will open(setting for MobiLinux) i.e to the screenshot.
#4 Go to Memory Tab in left Pane.
#5 click on a dynamic checkbox and set minimum value to some lower amount say 512, and max value to the desired one,
#6 apply
now it will start running as well after few minutes take the amount it required as well.
回答by Shubham Chadokar
It is not the problem of RAM. It is the allocated disk memory to docker.
It means there is not enough space for docker to create an image or any other docker related operations.
这不是内存的问题。它是分配给 docker 的磁盘内存。
这意味着 docker 没有足够的空间来创建图像或任何其他与 docker 相关的操作。
Open the docker settings >> advanced >> disk image max size
打开 docker 设置 >> 高级 >> 磁盘映像最大大小
Increase this size and apply the changes.
增加此大小并应用更改。
It will restart automatically and then you're good to go.
它会自动重新启动,然后你就可以开始了。
回答by user11078255
Have you enabled NUMA spanning in your HyperV settings? if not enable it i bet that will solve your issue.
您是否在 HyperV 设置中启用了 NUMA 跨越?如果不启用它,我敢打赌这将解决您的问题。
By default, Windows Server enables NUMA spanning, which provides the most flexibility as virtual machines (VMs) can access and use memory in any NUMA node. But it may result in lower performance compared to forcing VMs to use memory on the same NUMA node as the processor cores.
默认情况下,Windows Server 启用 NUMA 跨越,这提供了最大的灵活性,因为虚拟机 (VM) 可以访问和使用任何 NUMA 节点中的内存。但是,与强制 VM 在与处理器内核相同的 NUMA 节点上使用内存相比,这可能会导致性能降低。
By disabling NUMA spanning, you ensure that VMs use memory and processor cores in the same NUMA node, giving the best performance. This should only be changed once, if, as an administrator, you feel comfortable with NUMA and the implications of disabling and also if you have some additional management suite that can help ensure best configuration.
通过禁用 NUMA 跨越,您可以确保 VM 使用同一 NUMA 节点中的内存和处理器内核,从而提供最佳性能。如果作为管理员,如果您对 NUMA 和禁用的影响感到满意,并且如果您有一些额外的管理套件可以帮助确保最佳配置,则只应更改一次。
To configure NUMA spanning, open the Hyper-V Settings and select the NUMA Spanning option and disable it, I am sure, it will get solved; I struggled with the issue for a week and resolved it by disabling NUMA.
要配置 NUMA 跨越,打开 Hyper-V 设置并选择 NUMA 跨越选项并禁用它,我相信,它会得到解决;我为这个问题苦苦挣扎了一个星期,并通过禁用 NUMA 解决了它。
I am sure this would be marked as resolved by disabling NUMA in Hyper-V Manager.
我确信这会通过在 Hyper-V 管理器中禁用 NUMA 来标记为已解决。
回答by Acrilix
When I experienced this problem I modified the PowerShell script MobyLinux.ps1 found in the resources folder on the Docker install in C:\Program Files\Docker\Docker\resources. Essentially I forced the values for the $CPUs to 2 and the $Memory to 512, which worked for my dev box's limited resources!
当我遇到这个问题时,我修改了 C:\Program Files\Docker\Docker\resources 中 Docker 安装资源文件夹中的 PowerShell 脚本 MobyLinux.ps1。从本质上讲,我将 $CPUs 的值强制为 2,将 $Memory 的值强制为 512,这适用于我的开发箱的有限资源!
At this point when Docker drops the MobyLinuxVM instance in Hyper-V and re-creates it from the PowerShell script it now uses my values:
此时,当 Docker 在 Hyper-V 中删除 MobyLinuxVM 实例并从 PowerShell 脚本重新创建它时,它现在使用我的值:
This time the VM remains up and stable, and Docker successfully switches from the Windows Containers to the Linux Containers:
这次虚拟机保持正常运行,Docker 成功从 Windows Containers 切换到 Linux Containers:
Hope this helps someone.
希望这可以帮助某人。
回答by Allex Ferra
I have also the same problem. Maybe you have other virtual machine in Hyper-v, other Virtual machin need memory too. please stop all other Hyper-v Virtual machine and test again. for me worked My Hyper-v Manager
我也有同样的问题。也许您在 Hyper-v 中有其他虚拟机,其他虚拟机也需要内存。请停止所有其他 Hyper-v 虚拟机并再次测试。对我来说有效 我的 Hyper-v 管理器
回答by Mike Cheel
I lowered my memory and swap to the lowest it would go as well as the disk image size to 32gb and it finally started without switching to windows containers or having to reboot.
我将内存和交换降低到最低,磁盘映像大小也降低到 32GB,它最终启动而无需切换到 Windows 容器或必须重新启动。
回答by AHL
Problem: Installed Docker Desktop. Got Out of Memory error upon starting with linux instance.
问题:已安装 Docker 桌面。启动 linux 实例时出现内存不足错误。
Details: OS: Windows 10 Professional Host: Lenovo ThinkPad Carbon X1, 4GB RAM Docker Desktop: Version 2.1.0.1 (37199) Docker advanced settings:
详细信息:操作系统:Windows 10 Professional 主机:Lenovo ThinkPad Carbon X1,4GB RAM Docker 桌面:版本 2.1.0.1 (37199) Docker 高级设置:
- CPUs: 2
- Memory: 2048MB (this is the maximum)
- Swap: 2048MB
- Disk Image Size: 59.6GB (4MB used)
- CPU:2
- 内存:2048MB(这是最大值)
- 交换:2048MB
- 磁盘映像大小:59.6GB(已使用 4MB)
Hyper-V settings for DockerDesktopVM:
DockerDesktopVM 的 Hyper-V 设置:
- Settings > Memory > RAM: 2048MB (tried to increase to 4096; still doesn't work)
- Settings > Memory > Enable Dynamic Memory (checked/un-checked; both doesn't work)
- 设置>内存>内存:2048MB(尝试增加到4096;还是不行)
- 设置 > 内存 > 启用动态内存(选中/取消选中;两者都不起作用)
Under variations of the above settings, Docker Desktop gives this error when starting/ re-starting:
在上述设置的变化下,Docker Desktop 在启动/重新启动时会出现此错误:
Not enough memory to start Docker Desktop You are trying to start Docker Desktop but you don't have enough memory. Free some memory or change your settings.
内存不足,无法启动 Docker Desktop 您正在尝试启动 Docker Desktop,但内存不足。释放一些内存或更改设置。
The problem resolutions reported in the following links, e.g. starting with Windows instance, then switching back to Linux, don't work for me, regardless of how much memory I allocate via Hyper-V or Docker settings.
以下链接中报告的问题解决方案,例如从 Windows 实例开始,然后切换回 Linux,对我不起作用,无论我通过 Hyper-V 或 Docker 设置分配了多少内存。
It is utterly frustrating because apparently people are reporting being able to start with linux instances on host machines with 4GB of RAM. So I wonder what I am doing wrong.
这完全令人沮丧,因为显然人们报告说能够在具有 4GB RAM 的主机上启动 linux 实例。所以我想知道我做错了什么。
Resources researched/ tried:
研究/尝试的资源:
- https://forums.docker.com/t/not-enough-memory-to-start-docker/13512/24
- Docker won't start on Windows: Not Enough memory to start docker
- https://forums.docker.com/t/not-enough-memory-to-start-docker/13512/24
- Docker 无法在 Windows 上启动:没有足够的内存来启动 docker
Questions:
问题:
- Can I even run Docker Desktop with linux instance on my host machine?
- If (1) is yes, then what settings will allow me to do this?
- 我什至可以在我的主机上运行带有 linux 实例的 Docker Desktop 吗?
- 如果(1)是肯定的,那么什么设置可以让我这样做?