Skip to main content
Welcome to this comprehensive guide on using Docker on Windows. In this lesson, you’ll learn how to install Docker for Windows, verify the installation, and run both Linux and Windows containers. Follow along to set up your environment and start containerizing your applications effortlessly.

Installing Docker for Windows

Begin by logging into your Windows Server 2016 system and opening a web browser. Search for “Docker for Windows.” The top result should direct you to the Docker Store download page.
A Google search for "docker for windows" is displayed on a Windows desktop, showing results related to Docker installation and documentation.
Click on the download link labeled Get Docker CE for Windows to initiate the download. Once the download completes, execute the installation package. During the installation process, Docker automatically downloads additional dependencies from the internet and continues with the setup.
The image shows a webpage for downloading Docker CE for Windows, offering stable and edge versions, with installation and running instructions.
After the installation process finishes, a confirmation message appears instructing you to log out to complete the installation.
The image shows a successful installation message for Docker for Windows, version 17.06.2, prompting the user to log out to complete the installation.
Click Close and then log out. After logging back into your system, you will notice a new “Docker for Windows” shortcut on your desktop. Click the shortcut to launch Docker. In the bottom right corner, Docker will start up.
Docker for Windows depends on the Hyper-V feature. If you have not enabled Hyper-V, you will receive a warning. Click OK to enable Hyper-V; this will automatically restart your computer.
Once your computer restarts and you log in again, allow Docker to continue starting up. Open a command prompt to verify that Docker is running properly.

Verifying Docker Installation

To confirm your installation, run the following command in a command prompt:
Initially, you might encounter an error stating the Docker daemon is not found. This is because the service needs a bit more time to start. Once Docker is running (as indicated by a notification in the bottom right corner), re-run the command:
Notice that while the client operates on Windows, the server section indicates a Linux OS. This is because Docker for Windows deploys a lightweight Linux virtual machine via Hyper-V to run Linux containers.

Running Linux Containers on Windows

Validate your installation by running the hello-world container. This command pulls the “hello-world” image from Docker Hub and executes it inside the Linux virtual machine:
The output confirms that Docker is functioning correctly:
You can also start an interactive Ubuntu container with:
This confirms that Linux containers are running on your Windows machine through the Linux VM provided by Hyper-V. To inspect the Hyper-V deployment, open the Server Manager and navigate to Hyper-V. You should see a test virtual machine, which represents the Linux VM running Docker.
The image shows a Windows Server Manager interface for Hyper-V, displaying server details, events with errors and warnings, and a list of services.
Right-click the test VM and select Hyper-V Manager to view additional details.
The image shows the Hyper-V Manager interface with a virtual machine named "MobyLinuxVM" running, displaying its status, CPU usage, and memory allocation.

Switching to Windows Containers

Windows Server 2016 and Windows 10 Professional allow you to run Windows-based containers. To switch from Linux to Windows containers:
  1. Right-click the Docker icon in the system tray.
  2. Select Switch to Windows containers.
A notification will signal that the Containers feature is not enabled. On Windows Server 2016, this feature is built-in, but if it’s disabled, clicking OK will enable it and restart your computer.
The image shows a Windows Server Manager with a Docker for Windows prompt asking to enable the Containers feature, requiring a computer restart.
After restarting, open a command prompt again and execute the docker version command to verify that both the client and server are now running Windows:
Test your Windows container setup by running the hello-world container once more:
Because Windows-based images are generally larger than Linux images, the download and start-up may take a little longer. Once the image is downloaded and executed, you’ll see a success message confirming Docker is working with Windows containers. The output may also include an example command to run a Windows Server container:
This command starts a Windows Server Core container with a PowerShell prompt. You can use this image as a basis for building custom application images for Windows. To display a list of all running and stopped containers, use the following command:

Conclusion

This guide demonstrated the complete process of installing Docker for Windows, verifying the installation, and running both Linux and Windows containers. With Docker set up on your Windows machine, you are ready to explore containerized application development. For further reading: Happy containerizing, and see you in the next lesson!

Watch Video