Cannot uninstall Docker for Windows

Same thing happens to me. Trying to uninstall after literally everything about docker fails:

  1. can’t run hello-world
  2. can’t run cheers2019 tutorial
  3. can’t open docker desktop

I literally upgrade my windows system to install docker. Safe to say my experience thus far has been…sub-par.

Now all i wan to do is uninstall and reinstall, in the hopes that that will fix anything at all. Apparently that is an issue as well.

I used “regedit” searched for docker and deleted the registry keys so that the microsoft windows will forget that the docker is already installed

Then, I installed the latest version

I had an update issue on Windows 10 (1909) when trying to install 2.3.0.4 from 2.3.0.3. Based on a comment in this thread (Cannot uninstall Docker for Windows) by ebriney I killed the com.docker.service and retried which did work for me. Weird that the install process could not kill it even when running in admin mode.

Seriously, I had to wipe all Docker Folders inside C:/Program Files/Docker + all Data in Appdata/Roaming and Appdata/Local and LocalLow for it to be able to get reinstalled. Also every single Docker Registry entry.

Docker first wouldn’t update, it was stuck at updating when choosing to not install the update and the Installer encountered an error during repair/reinstall/upgrade. For any production totally unusable.

I get this error when I try to uninstall Docker on Windows Enterprise: (Stopped Docker , disabled it and ran this as administrator Docker"Docker Desktop Installer.exe" uninstall)
C:\Program Files\Docker>[15:01:17.869] [UninstallWorkflow] Reading installation manifest
[15:01:21.484] [UninstallWorkflow] Running before uninstall actions
[15:01:21.486] [UninstallWorkflow] Proceeding with CommunityInstaller.ExecAction
[15:01:23.467] [UninstallWorkflow] Action CommunityInstaller.ExecAction failed
Exception type: System.InvalidOperationException, Exception message: Process InstallerCli.exe exited with code 1, StackTrace:
at CommunityInstaller.ExecAction.d__28.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at CommunityInstaller.UninstallWorkflow.d__11.MoveNext()

Having run into installer issues with v 3.0.1, I’ve found that the main thing the docker checks for install state is the registry key “Docker Desktop” under Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

That’s where it pulls the currently installed version number from.

2 Likes

Hello!

I was run Docker Desktop on Windows 10 under WSL 1, then I tried to migrate to WSL 2 and somehow broke it, I can neither uninstall nor install a newer version of Docker. An attempt to delete docker files on a disk failed with an access error even under local admin. In my case, the problem was in conflict between the process of installation/uninstallation of Docker and some Docker services that were simultaneously running at that moment and somehow blocking it.

I fixed it by doing these steps:
1 delete Docker VM in Windows Hyper-V Manager
2 stop Docker service in Windows Service Manager
3 then I was able to delete all docker files on a disk (C:\Program Files\Docker)
4 download and install a fresh version of Docker
5 at that point it was still broken so I repeated steps 1 and 2 and then uninstalled it “normally” through windows Programs and Features > Uninstall
6 install Docker again, and at that point it was finally work

Hope it will help someone, cheers!

What has worked for me was opening up task manager and killing the docker service process and then I could install the newer one over the old one.

This is what finally allowed me to continue with the new install. This has been a problem for nearly half a decade. Such a shame really. Docker has some cool features, but is EXTREMELY fiddly.

I had faced the same issue - but it worked for me when I renamed the install dir C:/Program Files/Docker directory and then tried installing the latest version 4.10 with its installer.exe [More Info: I had installed Docker 4.3 in Windows 10 and later upgraded to Windows 11 and now I could uninstall 4.3 by renaming the dir and then install 4.10]

I came across this script and it worked for me. However the take ownership part was going to take days so it helps to have dual boot or live linux distro to bootup and manually delete the larger docker folders and also empty the trash before rebooting to Windows, then runing this only takes less than a minute vs days. Still can’t figure out how to mount a folder on a usb external storage drive pool…absolute path issue.

$ErrorActionPreference = “SilentlyContinue”

kill -force -processname ‘Docker for Windows’, com.docker.db, vpnkit, com.docker.proxy, com.docker.9pdb, moby-diag-dl, dockerd

try {
./MobyLinux.ps1 -Destroy
} Catch {}

$service = Get-WmiObject -Class Win32_Service -Filter "Name=‘com.docker.service’"
if ($service) { $service.StopService() }
if ($service) { $service.Delete() }
Start-Sleep -s 5
Remove-Item -Recurse -Force "~/AppData/Local/Docker"
Remove-Item -Recurse -Force "~/AppData/Roaming/Docker"
if (Test-Path “C:\ProgramData\Docker”) { takeown.exe /F “C:\ProgramData\Docker” /R /A /D Y }
if (Test-Path “C:\ProgramData\Docker”) { icacls “C:\ProgramData\Docker” /T /C /grant Administrators:F }
Remove-Item -Recurse -Force "C:\ProgramData\Docker"
Remove-Item -Recurse -Force "C:\Program Files\Docker"
Remove-Item -Recurse -Force "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Docker"
Remove-Item -Force "C:\Users\Public\Desktop\Docker for Windows.lnk"
Get-ChildItem HKLM:\software\microsoft\windows\currentversion\uninstall | % {Get-ItemProperty $.PSPath} | ? { $.DisplayName -eq “Docker” } | Remove-Item -Recurse -Force
Get-ChildItem HKLM:\software\classes\installer\products | % {Get-ItemProperty $.pspath} | ? { $.ProductName -eq “Docker” } | Remove-Item -Recurse -Force
Get-Item ‘HKLM:\software\Docker Inc.’ | Remove-Item -Recurse -Force
Get-ItemProperty HKCU:\software\microsoft\windows\currentversion\Run -name “Docker for Windows” | Remove-Item -Recurse -Force
#Get-ItemProperty HKCU:\software\microsoft\windows\currentversion\UFH\SHC | ForEach-Object {Get-ItemProperty $.PSPath} | Where-Object { $.ToString().Contains(“Docker for Windows.exe”) } | Remove-Item -Recurse -Force $.PSPath
#Get-ItemProperty HKCU:\software\microsoft\windows\currentversion\UFH\SHC | Where-Object { $(Get-ItemPropertyValue $) -Contains “Docker” }