-
Notifications
You must be signed in to change notification settings - Fork 14
Docker on Windows
Note: Skip the next two steps if you plan to run Windows native containers without Hyper-V and your Windows 10 version is >=1809.
"Microsoft-Hyper-V","Containers" | `
ForEach-Object { `
Get-WindowsOptionalFeature `
-FeatureName $_ `
-Online ;
} ;
Enable-WindowsOptionalFeature `
-FeatureName "Microsoft-Hyper-V", "Containers" `
-Online `
-All `
-NoRestart ;
This will download the latest stable version, alternative you can download and install the Edge release by replacing the download URL.
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 ;
Restart-Computer
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
Note: If you performed this step because you wanted to run native Windows containers without Hyper-V then you need to enable Hyper-V first to switch to the Linux Engine.
docker run -it microsoft/nanoserver cmd
If you run Windows 10 with a version >= 1809 you must use process isolation for building and running the container. It is also required that the host Windows version must match the Windows version running in the client container.
docker run --isolation=process -it mcr.microsoft.com/windows/nanoserver:1809