I created this gist on May 25, 2021. It is still an issue as of February 16th, 2026. Welcome to the future of web development. Take this Gist to rest and calm down.
- Uninstall docker the normal way (yeah you may have already done that)
- Copy this (or download):
# Leave swarm mode (this will automatically stop and remove services and overlay networks)
docker swarm leave --force
# Stop all running containers
docker ps --quiet | ForEach-Object {docker stop $_}
#just to be sure, sleep 5 seconds
Start-Sleep -s 5
#take ownership of docker files
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 }
#invoke cmd to delete docker files
cmd /c rmdir /s /q "C:\ProgramData\Docker"- save this as killDocker.ps1.
- go to start > powershell > run as administrator
- run
.\killDocker.ps1
what this does:
- kills all docker containers, if any
- take ownership of all docker files within
C:\ProgramData\Docker - remove
C:\ProgramData\Dockerby invoking cmd, because microsoft powershell is struggling to delete symlinks, of which docker has many
grab a coffee....
after 10 minutes or so it should be done. You're welcome.


Umm... I think I ran into a problem. I followed the steps, saved the script on my desktop, navigated to the desktop in powershell and tried to run it. First it said scripts can't be run, so I had to run
Set-ExecutionPolicy RemoteSignedfirst. Then I ran it again, and it first said something like "docker is not a recognized command", then it started setting administrator ownership. However, after a bit, it started setting permissions on files in my documents folder. I hit Ctrl+C to cancel it before it started deleting things. How did this happen?