To clean the Docker directory on Windows 11, follow these steps:
-
Open PowerShell as Administrator.
-
Run the following command to stop Docker services:
docker.exe stop
- Next, run the following command to remove Docker containers:
docker.exe rm $(docker.exe ps -a -q)
- Run the following command to remove Docker images:
docker.exe rmi $(docker.exe images -q)
- Run the following command to remove Docker volumes:
docker.exe volume rm $(docker.exe volume ls -q)
- Run the following command to remove Docker networks:
docker.exe network rm $(docker.exe network ls -q)
- Finally, run the following command to delete the Docker directory:
Remove-Item -Path "C:\ProgramData\docker" -Recurse -Force
- To reinstall Docker, download the Docker Desktop installer from the official website (https://www.docker.com/products/docker-desktop) and run it.
References:
- Docker documentation: https://docs.docker.com/engine/reference/commandline/cli/
- Docker Windows containers: https://docs.docker.com/desktop/windows/windows-containers/
- Docker troubleshooting: https://docs.docker.com/docker-for-windows/troubleshoot/