Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker uninstall instructions #684

Merged
merged 12 commits into from Dec 19, 2017
Expand Up @@ -21,7 +21,6 @@ Docker is required in order to work with Windows Containers. Docker consists of
* [Windows Containers on Windows Server 2016](../quick-start/quick-start-windows-server.md)
* [Windows Containers on Windows 10](../quick-start/quick-start-windows-10.md)


### Manual Installation
If you would like to use an in-development version of the Docker Engine and client instead, you can use the steps that follow. This will install both the Docker Engine and client. If you are a developer testing new features or using a Windows Insider build, you may need to use an in-development version of Docker. Otherwise, follow the steps in the Install Docker section above to get the latest released versions.

Expand Down Expand Up @@ -186,3 +185,72 @@ Restart-Service docker

For more information see, [Windows Configuration File on Docker.com](https://docs.docker.com/engine/reference/commandline/dockerd/#/windows-configuration-file).

## Uninstall Docker
*Use the steps in this section to uninstall Docker and perform a full cleanup of Docker system components from your Windows 10 or Windows Server 2016 system.*

> Note: All commands in the steps below must be run from an **elevated** PowerShell session.

### STEP 1: Prepare your system for Docker's removal
If you haven't already, it's good practice to make sure no containers are running on your system before removing Docker. Here are some useful commands for doing that:
```
# 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 $_}
```
It's also good practice to remove all containers, container images, networks and volumes from your system before removing Docker:
```
docker system prune --volumes --all
```

### STEP 2: Uninstall Docker

#### ***Steps to uninstall Docker on Windows 10:***
- Go to **"Settings" > "Apps"** on your Windows 10 machine
- Under **"Apps & Features"**, find **"Docker for Windows"**
- Click **"Docker for Windows" > "Uninstall"**

#### ***Steps to uninstall Docker on Windows Server 2016:***
From an elevated PowerShell session, use the `Uninstall-Package` and `Uninstall-Module` cmdlets to remove the Docker module and its corresponding Package Management Provider from your system.
> Tip: You can find the Package Provider that you used to install Docker with `PS C:\> Get-PackageProvider -Name *Docker*`

*For example*:
```
Uninstall-Package -Name docker -ProviderName DockerMsftProvider
Uninstall-Module -Name DockerMsftProvider
```

### STEP 3: Cleanup Docker data and system components
Remove Docker's *default networks,* so that their configuration won't stick around on your system once Docker is gone:
```
Get-HNSNetwork | Remove-HNSNetwork
```
Remove Docker's *program data* from your system:
```
Remove-Item "C:\ProgramData\Docker" -Recurse
```
You may also want to remove the *Windows optional features* associated with Docker/containers on Windows.

At a minimum, this includes the "Containers" feature, which is automatically enabled on any Windows 10 or Windows Server 2016 when Docker is installed. It may also include the "Hyper-V" feature, which is automatically enabled on Windows 10 when Docker is installed, but must be explicitly enabled on Windows Server 2016.

> **IMPORTANT NOTE ON DISABLING HYPER-V:** [The Hyper-V feature](https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/about/) is a general virtualization feature that enables much more than just containers! Before disabling the Hyper-V feature, make sure there are no other virtualized components on your system that require it.

#### ***Steps to remove Windows features on Windows 10:***
- Go to **"Control Panel" > "Programs" > "Programs and Features" > "Turn Windows features on or off"** on your Windows 10 machine
- Find the name of the feature/s you would like to disable--in this case, **"Containers"** and (optionally) **"Hyper-V"**
- **Uncheck** the box next to the name of the feature you would like to disable
- Click **"OK"**

#### ***Steps to remove Windows features on Windows Server 2016:***
From an elevated PowerShell session, use the following commands to disable the **"Containers"** and (optionally) **"Hyper-V"** features from your system:
```
Remove-WindowsFeature Containers
Remove-WindowsFeature Hyper-V
```

### STEP 4: Reboot your system
To complete these uninstall/cleanup steps, from an elevated PowerShell session, run:
```
Restart-Computer -Force
```