Introduction

This guide describes the steps I took to make Docker for Windows work on a Windows 10 Professional with Hyper-V, which requires Intel virtualization technology to be enabled in BIOS.

See https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v for Windows requirements, to be a Windows 10 Pro edition.

ContentS

Follow the steps in this guide to make Docker for Windows perform stable on Windows 10 Pro edition.

Making BIOS changes

Press Windows icon in lower left corner, search for “cmd”, then right click and choose “Run as administrator”.

shutdown.exe /r /o

When PC restarts select Advanced options and Restart to change firmware settings. When BIOS shows after next restart,  then enable Intel Virtualization Technology.

On some machines you can start BIOS, simply by holding F2 key or DEL key down during startup, this will be indicated in the messages shown at boot time.

As a developer I prefer functions keys F1..F12 to behave as function keys not media keys, so I suggest you also change advanved BIOS setting for functions keys to behave as standard functions keys, without pressing the Fn key first.

Once all BIOS settings are as you wish, choose save and exit to restart.

Install Docker for Windows

When Windows starts, then open Chrome browser and go to:

https://docs.docker.com/docker-for-windows/install/

Download and install “Get Docker for Windows (Stable)”.

Take note of the comment “Both Stable and Edge installers come with experimental features in Docker Engine enabled by default. Experimental mode can be toggled on/off on the Daemon tab of the Settings dialog.”.

When Docker is installed, right click Docker tray icon and select Settings and under Daemon remove checkmark in “Experimental features” and press “Apply”.

Create work directory

Press Windows icon in lower left corner, search for “cmd”, then right click and choose “Run as administrator” and make a working directory for Dockerfiles.

CMD>

mkdir c:\data\docker

PowerShell setup

CMD>

setx PSModulePath “C:\Program Files\WindowsPowerShell\Modules;c:\windows\system32\windowspowershell\v1.0\Modules” /M

CMD> %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -NoExit -Command cd c:\data\docker

PS>

echo $env:PSModulePath

Hyper-V setup

Enable the Hyper-V > Hyper-V Management Tools >Hyper-V Module for Windows PowerShell feature in Windows Features or with below PowerShell command line and then restart your machine.

PS>

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

TEST DOCKER IS Working

Test that Docker is working by stopping local Internet Information HTTP Server and starting a Docker Nginx image with a HTTP server.

PS>

iisreset /stop

docker run -p 80:80 -d -it nginx

 

Sometimes an error like below happens, then you need to right click Docker tray icon and select “Restart”, wait for Docker to restart before running Docker run command again:

C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: driver failed programming external connectivity on endpoint hardcore_lovelace (3b1520e5959ae0ed768f922661ca362237f712673fa32bc47bdde62bccd717d7): Error starting userland proxy: mkdir /port/tcp:0.0.0.0:80:tcp:172.17.0.2:80: input/output error.

 

After Docker container for Nginx image starts, open a Chrome browser and type http://localhost.

You will now be able to access the Nginx HTTP server from your local host outside the Docker container network, because we added the -p 80:80 mapping to the Docker run command.

This all works very fine for Docker Linux images, but for Docker Windows images please read “Limitations of Windows containers for localhost and published ports“ on the webpage https://docs.docker.com/docker-for-windows/troubleshoot/#limitations-of-windows-containers-for-localhost-and-published-ports