Docker/Kubernetes

How to install and uninstall Docker Desktop on Windows 10 and Windows Server

Dockerxx1

Docker is an open-source containerization platform that enables developers to package apps into containers and standardized executable components combining application source code with the operating system (OS) libraries and dependencies required to run that code in any environment. The Docker Engine and client aren’t included with Windows and need to be installed and configured individually. You need Docker in order to work with Windows Containers. Docker consists of the Docker Engine (dockerd.exe), and the Docker client (docker.exe). To run containers on Windows Server, you need a physical server or virtual machine running Windows Server 2022, Windows Server (Semi-Annual Channel), Windows Server 2019, or Windows Server 2016 as of the time of writing this article. More on this later. Kindly refer to these related guides: How to create and deploy a local Registry Server with Docker Image, how to Pull your first Nginx Container Image from Docker Hub and deploy it to your local machine, Azure DevOps and GitHub integration for Docker and Kubernetes deployment, how to create a static pod in Kubernetes, and how to install, register and start GitLab Runner on Windows.

GitLab Runner only supports the following versions of Windows as of the time of writing this pieace which follows the support lifecycle for Windows. You can use the following hyperlink for more information. 
- Windows Server 20H2.
- Windows Server 2004.
- Windows Server 1809.

This means that Docker only supports Docker Desktop on Windows for those versions of Windows 10 that are still within Microsoft’s servicing timeline:
- Long-Term Servicing Channel, versions for 5 years after their release date. Note that we don’t support versions that are on extended support.
- Semi-Annual Channel versions for 18 months after their release date. We don’t support these versions after mainstream support ends.
This is the case for both the Windows binaries that we distribute, and also for the Docker executor.

You can create a free Docker account for personal or small business users, however, for larger businesses, there is a monthly fee. For more details, see the

  • Our Docker Subscription Service Agreement includes a change to the terms of use for Docker Desktop
  • It remains free for small businesses (fewer than 250 employees AND less than $10 million in revenue), personal use, education, and non-commercial open source projects.
  • It requires a paid subscription for professional use in larger enterprises.
  • The effective date of these terms is August 31, 2021. There is a grace period until January 31, 2022 for those that will require a paid subscription to use Docker Desktop.
  • The existing Docker Free subscription has been renamed Docker Personal and we have introduced a Docker Business subscription .
  • The Docker Pro, Team, and Business subscriptions include commercial use of Docker Desktop.

Some of the key features of Docker Desktop include:

  • Ability to containerize and share any application on any cloud platform, in multiple languages and frameworks
  • Easy installation and setup of a complete Docker development environment
  • Includes the latest version of Kubernetes
  • Automatic updates to keep you up to date and secure
  • On Windows, the ability to toggle between Linux and Windows Server environments to build applications
  • Fast and reliable performance with native Windows Hyper-V virtualization
  • Ability to work natively on Linux through WSL 2 on Windows machines
  • Volume mounting for code and data, including file change notifications and easy access to running containers on the localhost network
  • In-container development and debugging with supported IDEs.

System requirements

Below are the hardware prerequisites are required to successfully run Client Hyper-V on Windows 10:
– 64-bit processor with Second Level Address Translation (SLAT),
– 4GB system RAM, and
– BIOS-level hardware virtualization support must be enabled in the BIOS settings. And, If this is not done, you will be prompted with the following error “Please enable the Virtual Machine Platform Windows Feature and ensure Virtualization is enabled in the BIOS“.

Your Windows machine must meet the following requirements to successfully install Docker Desktop.
1: Windows 10 64-bit: Pro 2004 (build 19041) or higher, or Enterprise or Education 1909 (build 18363) or higher.
2: For the WSL2 backend, please enable the WSL 2 feature on Windows. For detailed instructions, refer to these guides: What is Windows Subsystem for Linux (WSL), how to install WSL on Windows Server via Server Manager and PowerShell, and how to install WSL on Windows 10. You can install WSL with the following command wsl --install by entering the command either in PowerShell or the Command Prompt.

wsl-install

Alternatively, you can use the following command to install it very quickly as well. dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

Screenshot-2021-10-05-at-03.33.04

3: Download and install the WSL2 Linux kernel update package for x64 machines. You can also see this guide for more information Linux kernel update package.

4: Hyper-V and Containers Windows features must be enabled. Here is a similar guide to work you through how to install RSAT on Windows 10 via Windows features, and on a server, see how to install RSAT on Windows Server. You may also want to see this very detailed guide discussing “how to enable or disable DotNet Framework (NetFx3) via PowerShell, Control Panel, and DISM in Windows“.
5: To do this, launch the Windows Control Panel and click on Programs, and then on “Turn Windows features on or Off”.

As you can see, we already have the Hyper-V feature installed. We will have to check the “Container” feature as shown below.

Screenshot-2021-10-05-at-00.19.22

Ensure both the Hyper-V and Containers Windows features must be enabled. When you are done, click on OK.

Screenshot-2021-10-05-at-00.20.21-1

After these steps, Windows will search and apply the settings and you will be required to restart afterward.

Windows Server Containers use Hyper-V isolation by default on Windows 10 in order to provide developers with the same kernel version and configuration that will be used in production.

Install Docker Desktop

You need Docker in order to work with Windows Containers. Docker consists of the Docker Engine (dockerd.exe), and the Docker client (docker.exe). You can install Docker on Windows 10 Professional and Enterprise editions by using the following steps.

The Docker Desktop can be downloaded from the following link as shown below.

Screenshot-2021-10-05-at-01.14.49

It typically downloads to your Downloads folder, or you can run it from the recent downloads bar at the bottom of your web browser.
– To install the Docker Desktop, double-click on the Docker Desktop Installer.exe to run the installer.

Ensure you install the latest version of the Docker engine to avoid vulnerabilities
Screenshot-2021-10-05-at-01.15.38

Accept the User Account Control. You may want to learn how to turn UAC on or off in Windows.

Screenshot-2021-10-05-at-01.20.58

When prompted, ensure the install required Windows components for WSL 2 option is selected on the Configuration page.

This will unpack and install as shown below

As you can see below, the installation has succeeded. Just Close and Logout

Docker-succeeded
If you get this window close and restart, you may run into issues which means, the prerequisites defined above were not correctly follwed. I just had to simulate this on a different PC in my Lab. You have to click on close and restart and ensure you install WSL, the package update etc as defined above.
Screenshot-2021-10-05-at-01.41.29

Note: If your admin account is different from your user account, you must add the user to the docker-users group. Run Computer Management as an administrator and navigate to Local Users and Groups > Groups > docker-users. Right-click to add the user to the group. Log out and log back in for the changes to take effect

Screenshot-2021-10-05-at-02.12.58

Start Docker Desktop

The Docker Desktop does not start automatically after installation. To start Docker Desktop,
– Search for Docker, and select Docker Desktop in the search results.
Note: You can just click on the Docker Desktop available on the desktop of your PC because we selected to have it installed on the Desktop.

Screenshot-2021-10-05-at-01.48.33

The Docker menu displays the Docker Subscription Service Agreement window. It includes a change to the terms of use for Docker Desktop.
– Please refer to the 3rd paragraph above for more information.

Screenshot-2021-10-05-at-02.10.09

As you can see, Docker is now installed and started.

dockerxx1

You may want to sign into Docker Hub with your Docker IDas shown below

Screenshot-2021-10-05-at-02.37.30

If you wish to check for updates after logging in, please navigate to the Software Updates and click on Check for Updates.

Screenshot-2021-10-05-at-02.39.20

Now, let’s run some Docker commands. Below are some possible commands that you can run.

Currently, this is the version of Docker Desktop we are running

Screenshot-2021-10-05-at-02.58.33

Before you can use Docker, you will need to install the container images. For more information, see docs for our container base images.

Containers and images created with Docker Desktop are shared between all user accounts on machines where it is installed. This is because all Windows accounts use the same VM to build and run containers. Note that it is not possible to share containers and images between user accounts when using the Docker Desktop WSL 2 backend. Nested virtualization scenarios, such as running Docker Desktop on a VMWare or Parallels instance might work, but there are no guarantees [Reference: Docker Docs].

Uninstall Docker Desktop

Uninstalling Docker Desktop destroys Docker containers, images, volumes, and other Docker-related data local to the machine, and removes the files generated by the application. To uninstall Docker Desktop from your Windows machine, please follow the steps discussed below.

From the Windows Start menu, select Settings > Apps > Apps & features as shown below
– Select Docker Desktop from the Apps & features list and then select Uninstall.

Alternatively, you could also launch Windows Control Panel, click on programs and Features and have the Docker Desktop uninstalled. Click Uninstall to confirm your selection.

Screenshot-2021-10-05-at-03.00.09

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, as shown in the following example:

Uninstall-Package -Name docker -ProviderName DockerMsftProvider
Uninstall-Module -Name DockerMsftProvider

You can find the Package Provider that you used to install Docker with PS C:\> Get-PackageProvider -Name *Docker*

Clean up Docker data and system components

After you uninstall Docker, you’ll need to remove Docker’s default networks so their configuration won’t remain on your system after Docker is gone. You can do this by running the following cmdlet:

Get-HNSNetwork | Remove-HNSNetwork

To remove Docker’s default networks on Windows Server 2016.

Get-ContainerNetwork | Remove-ContainerNetwork

Run the following cmdlet to remove Docker’s program data from your system:

Remove-Item "C:\ProgramData\Docker" -Recurse

Remove features associated with Docker/containers on Window

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.

Note: The Hyper-V feature 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 Hyper-V.

To remove Windows features on Windows 10:

  • Go to Control Panel > Programs > Programs and Features > Turn Windows features on or off.
  • Find the name of the feature or features you want to disable—in this case, Containers and (optionally) Hyper-V.
  • Uncheck the box next to the name of the feature you want to disable.
  • Select “OK”.

To remove Windows features on Windows Server 2016: From an elevated PowerShell session, run the following cmdlets to disable the Containers and (optionally) Hyper-V features from your system:

Remove-WindowsFeature Containers
Remove-WindowsFeature Hyper-V

Reboot your system

To finish uninstallation and cleanup, run the following cmdlet from an elevated PowerShell session to reboot your system:

Restart-Computer -Force

I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
Kindly subscribe to TechDirectArchive
This is default text for notification bar