Preeti
Preeti

Reputation: 723

Docker failed to initialize | Docker Desktop is shutting down

I am facing an issue with Docker for Windows application. This is happening after updating to newer version of 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. ".

I have tried many solutions like:

  1. Closed docker and restarted laptop after update.
  2. Deleting log files in C:\Users\{...}\AppData\Local\Docker
  3. Deleting files in C:\Users\{...}\AppData\Roaming\Docker
  4. Tried to bump to previous release but unsuccessful with the message
    Docker Docker launch

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. 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

P.S: I am working with Docker for Windows on Windows 10 machine with WSL2 enabled. I have also enabled Containers and Virtual Machine Platform in Windows Features.

Upvotes: 20

Views: 18637

Answers (13)

Skyguard
Skyguard

Reputation: 1603

I had to:

  1. delete "Docker" and "Docker Desktop" folders from C:\Users<username>\AppData\Roaming
  2. log out of Windows

after logging in to Windows, I was presented with a new "Docker Subscription Service Agreement" which I had to accept, then:

  1. [Start] the Docker Desktop service (Windows will ask you for elevated access.)
  2. login with my Docker account

This got it working for me.

Upvotes: 1

chordia.praveen
chordia.praveen

Reputation: 21

I just killed the already running docker-desktop from the task manager and started docker desktop again, and it worked.

Upvotes: 2

Nibbletz
Nibbletz

Reputation: 1

None of the "delete folder/file X" solutions worked for me. It ended up being much simpler than that: Open Task Manager and kill the running Docker Desktop process. After that, Docker Desktop started up with no problems.

Upvotes: 0

BugsForBreakfast
BugsForBreakfast

Reputation: 815

Managed to make it work agian by opening task admin and ending the docker task, apparently it was "running" but not really, maybe a bug but oh well just try that maybe you get it working without deleting or reinstalling anything.

Upvotes: 1

Csongor Halmai
Csongor Halmai

Reputation: 3895

Running C:\Program Files\Docker\Docker\resources\com.docker.backend.exe command caused this error message for me:

creating rootNode subnodes: constructing 'BackendServices' in 'rootNode': doing migrations: migrating features.json: invalid character '\x00' looking for beginning of value

Therefore, I needed to delete the c:\Users\<username>\.docker\features.json file, which indeed, contained only 0-bytes.

After this, I was able to start the binary.

Upvotes: 0

MarioPH
MarioPH

Reputation: 1

For MacOs users, I tried everything on this thread but nothing worked. The solution for me was to delete de hidden .docker folder located at the "Home" directory.

Upvotes: 0

user1920217
user1920217

Reputation: 153

I fixed this by removing following hidden folder C:\Users\{...}\.docker

Upvotes: 0

Daryn
Daryn

Reputation: 5097

If you are experiencing this on 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.

You don't have to delete %AppData%\Roaming\settings.json, just change a value in it.

Look for "vpnkitCIDR" in that settings.json file. If its value is:

  "vpnkitCIDR": "192.168.65.0/28",

... then the fix is:

  1. Kill the Docker Desktop process (if running)
  2. in %AppData%\Roaming\settings.json, change the value to
  "vpnkitCIDR": "192.168.65.0/24",
  1. Run Docker Desktop

Upvotes: 3

Didinya Johnson
Didinya Johnson

Reputation: 472

Fix: Manually remove this file \AppData\Roaming\Docker\locked-directories

I additionally run C:\Program Files\Docker\Docker\resources\com.docker.backend.exe and closed it gracefully.

After that it worked for me though i haven't tried a reboot.

Edit: Yes, works after a reboot as well

Upvotes: 8

Mukesh
Mukesh

Reputation: 586

It worked for me after removing the settings.json file as shown below

enter image description here

Upvotes: 36

northeastloon
northeastloon

Reputation: 51

Deleting docker folders in AppData\Roaming or AppData\Roaming did not work. Rolling back from v4.x to 3.6 worked.

Upvotes: 0

Preeti
Preeti

Reputation: 723

I re-installed Docker Desktop 4.3.2 for Windows. But before installing I took the backup of ext4.vhdx file present in C:\Users\{...}\AppData\Local\Docker\wsl\data. 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.

Upvotes: 0

Pablo Soto
Pablo Soto

Reputation: 31

Try also delete roaming/docker-desktop only inner files.

Upvotes: 3

Related Questions