简体   繁体   English

Docker 无法在 Windows 上初始化

[英]Docker Failed to Initialize on Windows

Here, I have problem regarding pulling docker-dev in docker image for making my development environment but when I tried to pull docker-dev.在这里,我在 docker 图像中拉动 docker-dev 以创建我的开发环境时遇到问题,但是当我尝试拉动 docker-dev 时。 I got the error like docker manifest not found.我收到类似 docker manifest not found 的错误。 Can anyone help me out with this error...plz任何人都可以帮我解决这个错误......请

before this I want to know about the docker failed to initialize error which i'm having right now...在此之前我想知道我现在遇到的 docker 无法初始化错误...

the error is like,错误就像, 在此处输入图像描述

I tried so many things like re-install the docker desktop or WSL updates, but didn't worked.我尝试了很多东西,例如重新安装 docker 桌面或 WSL 更新,但都没有用。

And error in the command be like...命令中的错误就像...... 在此处输入图像描述 So if someone can help me out with this....plz help me out所以如果有人能帮我解决这个问题....请帮帮我

Got the same issue and fixed it by deleting %appdata%\Docker as mentioned by Github User "tocklime"遇到了同样的问题,并通过删除 Github 用户“tocklime”提到的%appdata%\Docker来修复它

(Original Source : https://github.com/docker/for-win/issues/3088 ) (原文来源: https ://github.com/docker/for-win/issues/3088) 在此处输入图像描述

My solution: delete %appdata%\Docker\settings.json and let Docker to create a new one.我的解决方案:删除 %appdata%\Docker\settings.json 并让 Docker 创建一个新的。

Take a backup of the file for the next time it gets broken.备份文件以备下次损坏。

<tl;dr> <tl;博士>

I face this issue almost every month and I hope this will get fixed definitely.我几乎每个月都会遇到这个问题,我希望这肯定会得到解决。

Following tmBlackCape answer, I checked the %appdata%\Docker directory and found settings.json damaged (editor tells it's a binary file and of course it shouldn't).tmBlackCape回答之后,我检查了 %appdata%\Docker 目录,发现 settings.json 已损坏(编辑器告诉它是二进制文件,当然不应该)。

I deleted the file and Docker Service (still running) created a new one with default values.我删除了该文件,Docker 服务(仍在运行)创建了一个具有默认值的新文件。 If the service isn't running, just launch it again.如果服务没有运行,只需再次启动它。

You could need to change settings (via GUI, as recommended) to catch your needs.您可能需要更改设置(通过 GUI,如建议的那样)以满足您的需求。

I made a backup copy of my custom settings.json so next time I can replace the broken one without losing custom configuration.我制作了自定义 settings.json 的备份副本,因此下次我可以替换损坏的,而不会丢失自定义配置。

Go to the directory C:\Users-------\AppData\Roaming\Docker and delete the file settings.json .转到目录C:\Users--------\AppData\Roaming\Docker并删除文件settings.json Docker takes care of rewriting it at startup. Docker 负责在启动时重写它。

This manipulation solved the problem for me !这种操作为我解决了问题!

Docker failed to initialize Docker 初始化失败

C:\Users[USER]\AppData\Local\Docker C:\Users[USER]\AppData\Local\Docker

C:\Users[USER]\AppData\Roaming\Docker C:\Users[USER]\AppData\Roaming\Docker

C:\Users[USER]\AppData\Roaming\Docker Desktop C:\Users[USER]\AppData\Roaming\Docker 桌面

Once deleted above directory, I didn't have to do anything else, Docker Desktop started booting up as normal.删除上述目录后,我无需执行任何其他操作,Docker Desktop 开始正常启动。

This happened to me after Docker Desktop upgrade to version 3.6.0 (67351), too.在 Docker Desktop 升级到版本 3.6.0 (67351) 后,这也发生在我身上。 (Which was surprising, because it worked before the upgrade.) (这令人惊讶,因为它在升级之前就可以工作。)

Due to the help in the top answer right now, I went to the above settings directory: %appdata%\Docker , looked at the logs and deleted/renamed the file settings.json -> Docker Desktop started immediatelly ;由于现在最佳答案中的帮助,我去了上面的设置目录: %appdata%\Docker ,查看了日志并删除/重命名了文件 settings.json -> Docker Desktop 立即启动 there had been a process retrying in the background.有一个进程在后台重试。

In the time before that, the backend.exe.log had been all "unmarshal" something something:在此之前,backend.exe.log 都是“解组”的东西:

    settings.json: json: cannot unmarshal bool into Go struct field Content.proxyHttpMode of type string"
common/cmd/com.docker.backend/internal/settingsloader.GetSettings(0x0, 0x0, 0x0)

So, the above message 'tipped me off' as to where the actual error on start may be.因此,上面的消息“提示我”关于启动时的实际错误可能在哪里。 Hmm...唔...

For me the solutions here didn't help, but here's what helped.对我来说,这里的解决方案没有帮助,但这里有帮助。

  1. Make sure the folder .docker/ in your home directory isn't marked as hidden in Windows.确保主目录中的文件夹.docker/在 Windows 中未标记为隐藏。 If it's hidden, Docker won't see it.如果它被隐藏,Docker 将看不到它。
  2. Make sure docker has Active Directory to .docker folder.确保 docker 有 Active Directory 到.docker文件夹。 For example, if the owner of .docker/ is SYSTEM and not your user, Docker won't be able to read it and crash.例如,如果.docker/的所有者是SYSTEM而不是您的用户,Docker 将无法读取它并崩溃。

For me deleting the folder %appdata%\Docker did not work.对我来说,删除文件夹 %appdata%\Docker 不起作用。

Instead I had to run the following power shell command as admin.相反,我必须以管理员身份运行以下 power shell 命令。

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

References.参考。

  1. https://stackoverflow.com/a/63845592/1977871 https://stackoverflow.com/a/63845592/1977871

  2. https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v#enable-hyper-v-using-powershell https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v#enable-hyper-v-using-powershell

My windows features with running docker desktop are as follows.我的运行 docker 桌面的 windows 功能如下。

Windows 功能的屏幕截图

I had the same issue.我遇到过同样的问题。 I'm on Docker Desktop 4.8.0.我在 Docker 桌面版 4.8.0 上。 The following solution worked for me:以下解决方案对我有用:

  1. Uninstall Docker Desktop卸载Docker桌面
  2. Delete.docker folder from C:\Users\{Username}C:\Users\{Username}
  3. Delete Docker folder from C:\Users\{Username}\AppData\LocalC:\Users\{Username}\AppData\Local
  4. Delete Docker folder from C:\Users\{Username}\AppData\RoamingC:\Users\{Username}\AppData\Roaming
  5. Delete Docker folder from C:\Program FilesC:\Program Files中删除 Docker 文件夹
  6. Run CCleaner on Registry and Custom Clean在注册表和自定义清理上运行 CCleaner
  7. Restart Computer重启电脑
  8. Install Docker安装 Docker
  9. Restart Computer重启电脑
  10. Start Docker开始 Docker

That's all.就这样。

  1. Go to C:\Users\asd\AppData\Local and delete Downloaded Installation directory.转到 C:\Users\asd\AppData\Local 并删除下载的安装目录。
  2. C:\Users\asd\AppData\Roaming and delete Docker and Docker Desktop directory. C:\Users\asd\AppData\Roaming 并删除 Docker 和 Docker Desktop 目录。

Then start docker.然后启动码头工人。

Didn't found the AppData folder in users[myUser] or anywhere.在 users[myUser] 或任何地方找不到 AppData 文件夹。 re-install solve it for me重新安装为我解决

The error message I got was not exactly the same the OP got.我得到的错误信息与 OP 得到的不完全相同。 For me, it said Docker failed to initialize. Docker Desktop is shutting down对我来说,它说Docker failed to initialize. Docker Desktop is shutting down Docker failed to initialize. Docker Desktop is shutting down . Docker failed to initialize. Docker Desktop is shutting down

TL;DR TL;博士

The powershell executable was missing from my local machies PATH .我的本地机器PATH中缺少powershell可执行文件。 I had to add C:\Windows\System32\WindowsPowerShell\v1.0 and docker started again.我不得不添加C:\Windows\System32\WindowsPowerShell\v1.0并且 docker 再次启动。

The longer story更长的故事

I tried everything that was mentined in this thread and nothing worked for me.我尝试了该线程中提到的所有内容,但对我没有任何帮助。 When I looked at the task manager of my local machine to see if any docker-related process was started, I noticed that Docker Desktop.exe itself was started.当我查看本地机器的任务管理器以查看是否启动了任何与 docker 相关的进程时,我注意到Docker Desktop.exe本身已启动。 However, the com.docker.backend.exe not.但是, com.docker.backend.exe不行。 Docker tries to start that exe in an infinite loop, but as soon as it started it crashed again after half a second. Docker 尝试在无限循环中启动该 exe,但一旦启动,它在半秒后再次崩溃。

I then took a look into com.docker.backend.exe.log , which is located in %localappdata%\Docker\log\host and noticed the following line:然后我查看了位于 % com.docker.backend.exe.log %localappdata%\Docker\log\host中的 com.docker.backend.exe.log 并注意到以下行:

[2022-07-07T10:46:57.936079700Z][com.docker.backend.exe][F] exec: "powershell": executable file not found in %PATH%

I then went ahead and just added the path to powershell to PATH (which is C:\Windows\System32\WindowsPowerShell\v1.0 )`.然后我继续并将powershell的路径添加到PATH (即C:\Windows\System32\WindowsPowerShell\v1.0 )`。 As soon as I added that, everything started working again.我一添加,一切就又开始工作了。

I have no idea how the path to the powershell executable got removed from PATH .我不知道 powershell 可执行文件的路径是如何从PATH中删除的。 I certainly did not do that myself.我自己当然没有这样做。

您必须删除 %appdata%\\Docker 并重新启动计算机

It happened due to local data corruption.它是由于本地数据损坏而发生的。 You can check in VM log inside %appdata%\Docker.您可以在%appdata%\Docker. I was able to reset and restart by renaming setting.json and then restart the Docker desktop by deleting all the previous log folder and temp folder clean.我能够通过重命名setting.json来重置和重新启动,然后通过删除所有以前的日志文件夹和临时文件夹清理来重新启动 Docker 桌面。 If this does not help.如果这没有帮助。 Try to kill all the processes running in through the task manager尝试杀死通过任务管理器运行的所有进程在此处输入图像描述

and then run Power shell in administrator mode and then shoot the command if you are using an older version of Lsmanager Restart-Service LxssManager .然后以管理员模式运行Power shell ,如果您使用的是旧版本的 Lsmanager Restart-Service LxssManager ,则执行命令。 在此处输入图像描述

On my side, uninstalling HyperV did the trick :在我这边,卸载 HyperV 就可以了:

Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Hypervisor

I also (as suggested in the voted answer):我也(如投票答案中所建议):

  • Uninstalled docker desktop,卸载docker桌面,
  • Deleted any docker related content in %APPDATA% as suggested按照建议删除了 %APPDATA% 中的任何 docker 相关内容
  • Delete any docker related keyys in registry (may be not necessary)删除注册表中任何与 docker 相关的密钥(可能没有必要)
  • Then reinstalled it然后重新安装了

And it solved the problem (but without hyperV removal it didn't work).它解决了这个问题(但没有删除 hyperV 它不起作用)。

它通过删除文件 C:\Users{username}\AppData\Roaming\Docker\settings.json 解决了我

There are a few great solutions;有一些很好的解决方案; however, it didn't work for me.但是,它对我不起作用。 Most of the "fixes" suggested here are already implemented and it just didn't work.这里建议的大多数“修复”已经实施,只是没有奏效。 I chose a different approach.我选择了不同的方法。 I looked at the docker releases and saw what was actually affected by their latest version not working (4.10).我查看了 docker 版本,发现最新版本不工作(4.10)实际影响了什么。 These things are normal, especially if the software engine has been updated.这些都是正常的,尤其是在软件引擎已经更新的情况下。 Going through Docker releases, the latest release that didn't touch the Docker engine is 4.8.0.浏览 Docker 版本,没有触及 Docker 引擎的最新版本是 4.8.0。 I downloaded and works great.我下载了,效果很好。

最新更新 4.10.1 有问题,我降级到 4.6.1 并且它工作但我认为 powershell 与这个问题密切相关

Removing settings.json file or %AppData%\Docker folder did not work for me.删除settings.json文件或%AppData%\Docker文件夹对我不起作用。 After uninstalling/installing the docker, the issue was solved.卸载/安装 docker 后,问题得到解决。 (Note: I couldn't try other possible solutions that are required the admin privilege) (注意:我无法尝试其他需要管理员权限的可能解决方案)

The below Steps worked for me,以下步骤对我有用,

Step 01: Navigate to the below-mentioned paths and delete the below-mentioned directories,步骤01:导航到下面提到的路径并删除下面提到的目录,

C:\Users[USERNAME]\AppData\Local\Docker directory C:\Users[USERNAME]\AppData\Local\Docker 目录

C:\Users[USERNAME]\AppData\Roaming\Docker directory C:\Users[用户名]\AppData\Roaming\Docker 目录

C:\Users[USERNAME]\AppData\Roaming\Docker Desktop directory C:\Users[USERNAME]\AppData\Roaming\Docker 桌面目录

Then restart the docker again然后再次重启docker

If you didn't find the AppData folder in users[USERNAME] or anywhere如果您没有在 users[USERNAME] 或任何地方找到 AppData 文件夹

Step 02: Type the below path in the "Run" to directly open the app data location for you步骤02:在“运行”中输入以下路径,直接为您打开应用数据位置

%appdata%\Docker

Then Delete the below-mentioned directories,然后删除下面提到的目录,

C:\Users[USERNAME]\AppData\Local\Docker directory C:\Users[USERNAME]\AppData\Local\Docker 目录

C:\Users[USERNAME]\AppData\Roaming\Docker directory C:\Users[用户名]\AppData\Roaming\Docker 目录

C:\Users[USERNAME]\AppData\Roaming\Docker Desktop directory C:\Users[USERNAME]\AppData\Roaming\Docker 桌面目录

Then restart the docker again然后再次重启docker

Note: If these steps do not help you.注意:如果这些步骤对您没有帮助。 Try to kill all the processes running in through the task manager.尝试杀死通过任务管理器运行的所有进程。 And again delete the directories and start the docker再次删除目录并启动 docker

if you still can't find the issue you may use this trick and i'm 100% sure this will work如果你仍然找不到问题,你可以使用这个技巧,我 100% 确定这会起作用

first check your operating system is up to date means no remaining updates if you pass this step then come to 2 step open window command prompt in run as administrator then type wsl --install then type wsl --list --online then wsl --install -d Debian then open docker if error come then install wsl 2 linux https://learn.microsoft.com/en-us/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package首先检查您的操作系统是否是最新的意味着如果您通过此步骤则没有剩余的更新然后以管理员身份运行以 2 步打开 window 命令提示符然后键入 wsl --install 然后键入 wsl --list --online 然后 wsl -- install -d Debian 然后打开 docker 如果出现错误然后安装 wsl 2 linux https://learn.microsoft.com/en-us/windows/wsl/install-manual#step-4---download-the-linux-kernel -更新包

then restart docker or your machine and then if error also occur then type then wsl --update i hope this will work Regard: Hammad Khadim然后重新启动 docker 或您的机器,如果还发生错误,则键入 wsl --update 我希望这会起作用注意:Hammad Khadim

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

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