Container host can run
- Windows Server 2016 with Desktop
- Windows Server 2016 Core
- Nano Server

Deploy Docker


!!! Run Windows Updates before installing Docker !!!
Install-WindowsFeature Containers
Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
Instal1-Package -Name docker -ProviderName DockerMsftProvider
docker version
Set-Item WSMan:\localhost\Client\TrustedHosts 192.168.1.144 -Force #to add non-domain joined server
Enter-PSSession -ComputerName 192.168.1.144 -Credential (Get-Credential)
#Run Windows Updates
$sess = New-CimInstance -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperationsSession
Invoke-CimMethod -InputObject $sess -MethodName ApplyApplicableUpdates
Restart-Computer
#Install Docker
Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
Install-Package -Name docker -ProviderName DockerMsftProvider
Restart-Computer -Force
#Sample script to configure Docker engine for remote connections
netsh advfirewall firewall add rule name="Docker daemon" dir=in action=allow protocol=TCP localport=2375
new-item -Type File c:\ProgramData\docker\config\daemon.json
Add-Content 'c:\ProgramData\docker\config\daemon.json' '{ "hosts": ["tcp://0.0.0.0:2375", "npipe://"] }'
Restart-Service docker
Start-Service docker
Get-Service docker


PowerShell Gallery - DockerMsftProvider 1.0.0.1

Host Operating System Windows Container Hyper-V Container
Windows Server 2016 with Desktop Server Core / Nano Server Server Core / Nano Server
Windows Server 2016 Core Server Core / Nano Server Server Core / Nano Server
Nano Server Nano Server Server Core / Nano Server
Container host deployment - Nano Server

Docker Engine Configuration - Docker Daemon
Docker - Windows configuration file

Docker Engine on Windows - Configure Docker with Configuration File

#Sample Docker Client Setup Script
$package = "<a href="https://download.docker.com/components/engine/windows-server/cs-1.12/docker.zip"">https://download.docker.com/components/engine/windows-server/cs-1.12/docker.zip"</a>
Invoke-WebRequest $package `
-OutFile "$env:TEMP\docker.zip" `
-UseBasicParsing
Expand-Archive -Path "$env:TEMP\docker.zip" `
-DestinationPath $env:ProgramFiles
[Environment]::SetEnvironmentVariable(
 "Path", $env:Path + ";$($env:ProgramFiles)\Docker", [EnvironmentVariableTarget]::Machine)

[Environment]::SetEnvironmentVariable(
"DOCKER_HOST", "192.168.1.144", [EnvironmentVariableTarget]::Machine)

#check
ii $env:ProgramFiles  #docker folder with docker.exe & dockerd.exe
docker -H tcp://192.168.1.144:2375 version #remote run

[Environment]: SetEnvironmentVariable(
"DOCKER_HOST", "192.168.1.144", [EnvironmentVariableTarget]::Machine)


Pulling Base Container Images
Docker Hub - Repository
type nanoserver into search box
docker pull microsoft/nanoserver
docker pull microsoft/nanoserver:10.0.14393.576
# ^ this pulls older version - specific tag, just click Tags tab on the Image page ^
docker images
docker pull microsoft/windowsservercore
docker run --help


Running Windows Containers
{/code}
docker run -it microsoft/nanoserver:latest cmd
CTRL+PQ #exit / drop out of container
docker ps
docker run -it --name srv01 microsoft/nanoserver cmd
docker stop srv01
docker images
docker run -d microsoft/nanoserver:10.0.14393.576 ping -t 4.2.2.3
docker exec -it 8b cmd #run cmd inside container
docker inspect f8
{/code}

Enable Nested Virtualization - for Hyper-V Containers
#Sample script for setting up nested virtualization on a Hyper-V VM
#Replace with the virtual machine name
$vm = "<virtual-machine>"
#Configure virtual processor -count parameter is optional
Set-VMProcessor -VMName $vm -ExposeVirtualizationExtensions $true -Count 2
#Disable dynamic memory
Set-VMMemory $vm -DynamicMemoryEnabled $false
#Enable mac spoofing
Get-VMNetworkAdapter -VMName $vm | Set-VMNetworkAdapter -MacAddressSpoofing On
Start-VM $vm


Running Hyper-V Containers
Install-WindowsFeature Hyper-V
Restart-Computer
docker run -d --name srv01 microsoft/nanoserver ping -t 4.2.2.3
docker run -d --name srv02 --isolation=hyperv microsoft/nanoserver ping -t 4.2.2.3
docker inspect -f  "{{.HostConfig.Isolation}}" srv01 


Docker run reference
Detached vs Foreground (Interactive) Mode
To start a container in detached mode, you use -d=true or just -d option. By design, containers started in detached mode exit when the root process used to run the container exits.

In foreground mode (the default when -d is not specified), docker run can start the process in the container and attach the console to the process’s standard input, output, and standard error. It can even pretend to be a TTY (this is what most command line executables expect) and pass along signals.For interactive processes (like a shell), you must use -i -t together in order to allocate a tty for the container process.

PowerShell For Docker - Microsoft Docs
PowerShell for Docker Repo - GitHub