Skip to content

Docker on Windows

Christoph Diehl edited this page Jan 18, 2019 · 9 revisions

Docker on Windows

Validate Hyper-V and Containers Windows 10 Features are Enabled

"Microsoft-Hyper-V","Containers" | `
    ForEach-Object { `
        Get-WindowsOptionalFeature `
            -FeatureName $_ `
            -Online ;
    } ;

Install Hyper-V and Containers Windows 10 Features

Enable-WindowsOptionalFeature `
    -FeatureName "Microsoft-Hyper-V", "Containers" `
    -Online `
    -All `
    -NoRestart ;

Download and Install Docker

Invoke-WebRequest `
    -UseBasicParsing `
    -Uri "https://download.docker.com/win/stable/Docker%20for%20Windows%20Installer.exe" `
    -OutFile "$Env:TEMP\DockerForWindowsInstaller.exe" ;
Start-Process `
    -FilePath "$Env:TEMP\DockerForWindowsInstaller.exe" `
    -ArgumentList "install", "--quiet" `
    -Wait ;

Reboot

Restart-Computer

Switch Docker Daemon

By default Docker on Windows is configured to run LCOW, in order to run Windows native containers we need to switch the Docker Daemon. Verify for which OS the Docker Daemon is configured.

PS C:\Users\posidron> docker version
Client: Docker Engine - Community
 Version:           18.09.1
 API version:       1.39
 Go version:        go1.10.6
 Git commit:        4c52b90
 Built:             Wed Jan  9 19:34:26 2019
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.1
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.6
  Git commit:       4c52b90
  Built:            Wed Jan  9 19:41:49 2019
  OS/Arch:          linux/amd64
  Experimental:     false

Server: OS/Arch says linux/amd64

& $Env:ProgramFiles\Docker\Docker\DockerCli.exe -SwitchDaemon
docker version

The output should now show windows/amd64 for the Docker Server. It is possible to set the Docker Daemon explicitly instead of using the -SwitchDaemon parameter.

-SwitchLinuxEngine
-SwitchWindowsEngine

Run Mircosoft NanoServer

docker run -it microsoft/nanoserver powershell
Clone this wiki locally