Closed beckerben closed 10 months ago
Hi! Great question. @brasmith-ms might know more about this than I but I can take a stab at it.
# Check if any containers are still running
docker ps
Stop-Service -Name docker
& dockerd --unregister-service
ProgramData
folder. (This path might be different for you depending on your configuration but it's under C:/
for me).
Remove-Item -Path C:\ProgramData\docker -Recurse
$service = Get-Service -Name "docker" -ErrorAction SilentlyContinue
$service -eq $null
# if it prints out True then docker is not installed (yay)
# if it prints out False then a previous command failed
@ntrappe-msft looks easy enough, thanks.
It probably makes sense to get a section added to the formal docs for reference as well.
Totally agree, we'll write up something. Just re-open this if anything doesn't work.
I previously installed Containerd together with nerdctl. I want to switch to Moby/Docker CE and thereby uninstall containerd/nerdctl. I ran the commands from above and switched docker with containerd. But in step 4 when trying to remove the program data I get a lot of access violations (although I ran it in an elevated PS).
For example:
Remove-Item : Cannot remove item C:\ProgramData\containerd\root\io.containerd.snapshotter.v1.windows\snapshots\9\Files\Windows\WaaS: Access to the path 'WaaS' is denied.
We just got around to trying this process that @ntrappe-msft mentioned and ran into permission errors doing the delete from an elevated shell. We found that in order to delete the "docker" folder we had to take ownership of it and then were able to perform the delete.
I spoke too soon, the command looked like it was working but it ended up having issues removing the "C:\ProgramData\docker\windowsfilter". We ended up having to use this: https://github.com/moby/docker-ci-zap
Hmm I'll look into what's happening. Thanks for the heads up.
Ah yep it's probably not a good idea to use the docker-ci-zap tool unless you never want to install docker again. It doesn't let you automatically delete the docker/windowsfilter
folder because it's actually the storage driver Docker uses to save images and container metadata. I'll work on an uninstall script that can safely remove the driver and everything else.
I see, we had no problems using the tool and then re-installing. We were hoping to install to a different drive altogether but not sure that is possible from what we have seen so we ended up re-installing everything via the script and moved our data directory to another drive.
Hi! Great question. @brasmith-ms might know more about this than I but I can take a stab at it.
- Make sure you kill any containers that are running or push any images you want to save to Docker Hub.
# Check if any containers are still running docker ps
- Stop the Docker service so you can remove it. Run the following an Administrator PowerShell window:
Stop-Service -Name docker
- Unregister dockerd also in that PowerShell window:
& dockerd --unregister-service
- Remove docker from your
ProgramData
folder. (This path might be different for you depending on your configuration but it's underC:/
for me).Remove-Item -Path C:\ProgramData\docker -Recurse
- Check that the Docker service no longer exists:
$service = Get-Service -Name "docker" -ErrorAction SilentlyContinue $service -eq $null # if it prints out True then docker is not installed (yay) # if it prints out False then a previous command failed
Thanks, these instructions worked just fine for uninstalling the Docker server in our case. But, how would one go about uninstalling the the Docker client after this? We're planning on installing Docker to a different machine instead, and we have no use on having the client still sitting there
@CebolaBros64 Are you trying to remove the Docker CLI? Usually the Docker Client consists of that.
@ntrappe-msft Yes, that's correct
Did you try removing Docker Desktop? That's usually what adds/removes the Docker CLI.
Docker Desktop isn't installed, as the machine is running Windows Server 2019 and isn't compatible. I was under the impression the install-docker-ce.ps1
script was what added the CLI, is that not the case?
Hi, you're right, the install-docker-ce.ps1
script does install it. I just wanted to make sure that's what you were working with. We're going to release an official uninstall script soon but here are some steps you can take in the meantime:
where.exe docker
C:\Program Files\Docker\Docker\resources\bin\docker
C:\Program Files\Docker\Docker\resources\bin\docker.exe
Remove-Item -Path "C:\Program Files\Docker\Docker\resources\bin\docker" -ErrorAction SilentlyContinue
Remove-Item -Path "C:\Program Files\Docker\Docker\resources\bin\docker.exe" -ErrorAction SilentlyContinue
docker
Thank you, that did the job :)
I didn't see any mention in the documentation if we installed using the install-docker-ce.ps1 on windows server how to actually perform an uninstallation? We wanted to move the installation from C:\ to D:\ an wasn't sure how to properly do the uninstall.