简体   繁体   English

Docker 初始化失败 | Docker 桌面正在关闭

[英]Docker failed to initialize | Docker Desktop is shutting down

I am facing an issue with Docker for Windows application.对于 Windows 应用程序,我面临 Docker 的问题。 This is happening after updating to newer version of 4.3.2.这是在更新到 4.3.2 的较新版本后发生的。 Previous version was running without any issues.以前的版本运行没有任何问题。 After downloading and updating to new version, whenever I launch Docker Desktop I get error message " Docker failed to initialize. Docker Desktop is shutting down. ".下载并更新到新版本后,每当我启动 Docker 桌面时,我都会收到错误消息“Docker 初始化失败。Docker 桌面正在关闭。”。

I have tried many solutions like:我尝试了很多解决方案,例如:

  1. Closed docker and restarted laptop after update.更新后关闭 docker 并重新启动笔记本电脑。
  2. Deleting log files in C:\Users\{...}\AppData\Local\Docker删除C:\Users\{...}\AppData\Local\Docker中的日志文件
  3. Deleting files in C:\Users\{...}\AppData\Roaming\Docker删除C:\Users\{...}\AppData\Roaming\Docker中的文件
  4. Tried to bump to previous release but unsuccessful with the message试图跳转到以前的版本但未成功显示消息
    码头工人 Docker 启动

Can anyone please help me resolve this issue as I have already wasted few hours to resolve this.谁能帮我解决这个问题,因为我已经浪费了几个小时来解决这个问题。

I am not sure if I should completely uninstall docker and install freshly.我不确定是否应该完全卸载 docker 并重新安装。 If doing so, may remove all existing volumes and containers.如果这样做,可能会删除所有现有的卷和容器。 I don't want to lose existing containers and data.我不想丢失现有的容器和数据。 BTW, I didn't sign-in while working with containers.顺便说一句,我在使用容器时没有登录。

Your help will be much appreciated.非常感谢您的帮助。

Thanks in advance提前致谢

PS: I am working with Docker for Windows on Windows 10 machine with WSL2 enabled. PS:我在启用了 WSL2 的 Windows 10 机器上使用 Docker for Windows。 I have also enabled Containers and Virtual Machine Platform in Windows Features.我还在 Windows 功能中启用了容器和虚拟机平台。

Fix: Manually remove this file \AppData\Roaming\Docker\locked-directories修复:手动删除此文件 \AppData\Roaming\Docker\locked-directories

I additionally run C:\Program Files\Docker\Docker\resources\com.docker.backend.exe and closed it gracefully.我另外运行 C:\Program Files\Docker\Docker\resources\com.docker.backend.exe 并正常关闭它。

After that it worked for me though i haven't tried a reboot.之后它对我有用,尽管我没有尝试重新启动。

Edit: Yes, works after a reboot as well编辑:是的,重启后也可以工作

Try also delete roaming/docker-desktop only inner files.也尝试删除 roaming/docker-desktop only 内部文件。

If you are experiencing this on v 4.13,如果您在 v 4.13 上遇到此问题,

Then a simpler fix is described in the Docker for windows [issue: docker desktop failed to initialize](Per https://github.com/docker/for-win/issues/13025 ) from Oct 2022.然后,Docker 中针对 windows [问题:docker 桌面无法初始化](根据https://github.com/docker/for-win/issues/13025 )从 2022 年 10 月开始描述了一个更简单的修复。

You don't have to delete %AppData%\Roaming\settings.json , just change a value in it.您不必删除%AppData%\Roaming\settings.json ,只需更改其中的一个值即可。

Look for "vpnkitCIDR" in that settings.json file.在该 settings.json 文件中查找"vpnkitCIDR" If its value is:如果它的值为:

  "vpnkitCIDR": "192.168.65.0/28",

... then the fix is: ...然后修复是:

  1. Kill the Docker Desktop process (if running)终止 Docker 桌面进程(如果正在运行)
  2. in %AppData%\Roaming\settings.json , change the value to%AppData%\Roaming\settings.json ,将值更改为
  "vpnkitCIDR": "192.168.65.0/24",
  1. Run Docker Desktop运行 Docker 桌面

I re-installed Docker Desktop 4.3.2 for Windows.我为 Windows 重新安装了 Docker Desktop 4.3.2。 But before installing I took the backup of ext4.vhdx file present in C:\Users\{...}\AppData\Local\Docker\wsl\data .但在安装之前,我备份了C:\Users\{...}\AppData\Local\Docker\wsl\data中存在的ext4.vhdx文件。 But fortunately any of the volumes and containers were removed and everything is restored and working fine.但幸运的是,所有的卷和容器都被删除了,一切都恢复了并且工作正常。

To be on safer side, if anyone is facing similar situation please have the backup of ext4.vhdx and you can restore your data from it.为了安全起见,如果有人遇到类似情况,请备份ext4.vhdx ,您可以从中恢复数据。

Deleting docker folders in AppData\Roaming or AppData\Roaming did not work.删除 AppData\Roaming 或 AppData\Roaming 中的 docker 文件夹无效。 Rolling back from v4.x to 3.6 worked.从 v4.x 回滚到 3.6 有效。

It worked for me after removing the settings.json file as shown below删除settings.json文件后它对我有用,如下所示

在此处输入图像描述

I fixed this by removing following hidden folder C:\Users\{...}\.docker我通过删除以下隐藏文件夹C:\Users\{...}\.docker

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM