Slide 1

Slide 1 text

Windows Server Container Windows learns to speak Docker

Slide 2

Slide 2 text

Your Host Rainer Stropek Developer, Entrepreneur MVP Microsoft Azure MVP Development Technologies MS Regional Director Senior Consultant IT-Visions Contact software architects gmbh [email protected] Twitter: @rstropek

Slide 3

Slide 3 text

Agenda With Windows Server 2016, Windows learns to speak Docker. In this session, Rainer Stropek, long-time Azure MVP and MS Regional Director, introduces Windows Server Containers. You see how to manage them with PowerShell and the Docker CLI. Additionally, Rainer will demonstrate Dockerfiles with containers on Windows. Note that Rainer assumes for this session that you already have basic knowledge about PowerShell and the Docker CLI.

Slide 4

Slide 4 text

Overview Available Options and Tools

Slide 5

Slide 5 text

Microsoft  Containers Docker client on Windows In Windows shell In Bash shell (Bash on Ubuntu on Windows)

Slide 6

Slide 6 text

Demo Docker Client Docker Client in Windows Shell Ubuntu subsystem for Windows Not Docker, not Hyper-V Pico processes Bash on Ubuntu on Windows Advantage: Completion (e.g. image name in docker run)

Slide 7

Slide 7 text

Microsoft  Containers Docker client on Windows In Windows shell In Bash shell (Bash on Ubuntu on Windows) Linux containers on Windows Docker for Windows Windows containers on Windows Windows Server containers Hyper-V containers Docker support on Windows Server 2016 and Windows 10

Slide 8

Slide 8 text

Microsoft  Containers Ready-made containers For Linux and Windows See Docker Hub (e.g. Azure CLI, .NET Core, PowerShell, IIS) Containers on Azure Templates (e.g. Docker on Unbuntu) and drivers from Microsoft (details later) Docker Machine with Azure driver Run clusters (DC/OS, Docker Swarm, Kubernetes) with Azure Container Service Visual Studio Support Visual Studio Tools for Docker VSTS Docker Extension

Slide 9

Slide 9 text

Strengths and Limits Windows Server vs. Hyper-V Containers Managed almost identically (Docker and PowerShell) Difference: Isolation level More details in MSDN Source: Mark Fussel (Microsoft), Azure Service Fabric - Build always-on, hyper-scalable, microservice-based cloud applications Linux Windows Process Linux Container Virtual Machines Process Windows Server Container Hyper-V VMs Hyper-V Container Quotas, Limits Added Isolation Kernel Kernel Faster, more efficient More isolated, more secure

Slide 10

Slide 10 text

Windows on Windows Running Windows containers on Windows

Slide 11

Slide 11 text

Windows on Windows OS Support Windows Server 2016 Windows 10 (Hyper-V Container) Windows Server Container Hyper-V Container Additional isolation layer Runs inside of Windows Nano Server VM docker run -it --rm --isolation=hyperv microsoft/nanoserver cmd

Slide 12

Slide 12 text

Demo Windows Container Docker on Windows Server 2016 Full Server Nano Server Connect Docker client Docker client on Host Remote Docker (Linux and Windows) client Container scenarios Interactive container Dockerfiles on Windows Volume mapping Ready-made container (.NET)

Slide 13

Slide 13 text

Demo # Ping Docker host on Windows Server docker -H tcp://1.2.3.4:2375 info set DOCKER_HOST=tcp://1.2.3.4:2375 docker info docker ps -a docker images # Run ’dir’ inside a short-lived Nano Server container docker run -it --rm microsoft/nanoserver cmd /C dir # Run existing IIS image (source: Microsoft) docker run -d -p 80:80 microsoft/iis cmd ping localhost -t # Build Dockerfile, install IIS (details about IIS on Nano see # https://technet.microsoft.com/en-us/library/mt627783.aspx) docker build -t myiis . docker images docker run -it --rm myiis cd \install dism /online /apply-unattend:.\unattend.xml net start w3svc # On Docker host (e.g. Enter-PSSession) echo Hello > c:\temp\greeting.txt Docker run --rm -v c:\temp:c:\somedir microsoft/nanoserver cmd /C type \somedir\greeting.txt Prerequisites Windows Server with Container support See also sample Dockerfile https://github.com/rstropek/DockerVS2015Intro/blob/master/do ckerDemos/07-win-container-nano-server/Dockerfile

Slide 14

Slide 14 text

Demo FROM microsoft/dotnet:sdk-nanoserver RUN mkdir \app WORKDIR \app RUN dotnet new -t web & dotnet restore CMD ["dotnet", "run"] .NET Web Server in Dockerfile

Slide 15

Slide 15 text

Nano Server Windows OS for the Cloud

Slide 16

Slide 16 text

Windows OS for the Cloud Optimized for the cloud (private/public) Smaller footprint, faster startup, less update, etc. How can it be smaller and faster? Headless (=no GUI) Limited functionality (e.g. only 64bit, no AD domain controller, no group policy, …; details) Current Branch for Business (CBB) 2-3 feature update/year for Nano Server Not more than two Nano Server CBB releases behind for support (details)

Slide 17

Slide 17 text

Installation Tip: You can create custom Windows images to be used as a baseline

Slide 18

Slide 18 text

Demo Install Nano Server Create VHD Add virtual Machine Connect Remote PowerShell

Slide 19

Slide 19 text

Installation # Location where the Windows Server 2016 ISO is mounted. # We will copy the Nano Server Image Generator from there. $winServerInstallRoot = "d:\" $temp = "c:\temp" $nanoServerImageGeneratorFolder = "$temp\NanoServerImageGenerator" $targetPath = $temp + "\demo\NanoServerVM.vhd" $computerName = "mynanoserver" $secure_string_pwd = convertto-securestring "pass" -asplaintext -force [Environment]::SetEnvironmentVariable("TEMP", "c:\temp\tempFolder",` "Process") # Copy Nano Server Image Generator to local disk if (!(Test-Path -Path "$nanoServerImageGeneratorFolder")) { Copy-Item "$winServerInstallRoot\NanoServer\NanoServerImageGenerator" ` "$nanoServerImageGeneratorFolder" -Recurse -Force } # Import Nano Generator module cd $nanoServerImageGeneratorFolder Import-Module .\NanoServerImageGenerator -Verbose # Create Nano Server ISO VHD New-NanoServerImage -Edition Standard -DeploymentType Guest ` -MediaPath $winServerInstallRoot ` -BasePath .\Base -TargetPath $targetPath -ComputerName $computerName ` -AdministratorPassword $secure_string_pwd ` -Package Microsoft-NanoServer-Guest-Package -MaxSize 100GB ` -EnableRemoteManagementPort -Verbose Create VHD https://github.com/rstropek/DockerVS2015Intro/blob/master/do ckerDemos/07-win-container-nano-server/setup-simple-nano- server.ps1

Slide 20

Slide 20 text

Installation Import-Module Hyper-V net start WinRM $computerName = "Simple Nano Server" $vm = Get-VM -Name $computerName $vmIP = (Get-VMNetworkAdapter $vm)[0].IPAddresses[0] Set-Item WSMan:\localhost\Client\TrustedHosts $vmIP -Force $cred = Get-Credential $session = New-PSSession -ComputerName $vmIP -Credential $cred Enter-PSSession -Session $session Connect and create session https://github.com/rstropek/DockerVS2015Intro/blob/master/do ckerDemos/07-win-container-nano-server/connect-nano- server.ps1

Slide 21

Slide 21 text

Deployment Virtual machine from ISO Physical machine Dual boot VHD/VHDX PxE-boot and install Nano Server from WDS (details) Booting into WinPE and deploying Nano Server using a .wim file (details) Tip: Consider Nano Server Image Builder GUI

Slide 22

Slide 22 text

PowerShell PowerShell Core Edition Limited functionality Details in TechNet Guidelines for porting to PowerShell Core available Details in TechNet

Slide 23

Slide 23 text

Container Container Host Installation details Container Base Image microsoft/nanoserver on Docker Hub

Slide 24

Slide 24 text

Developer Tools Visual Studio support

Slide 25

Slide 25 text

Visual Studio Docker Tools for Visual Studio Docker support for Visual Studio Code

Slide 26

Slide 26 text

TFS/VSTS Docker extensions for TFS/VSTS

Slide 27

Slide 27 text

Summary

Slide 28

Slide 28 text

Summary Microsoft  Linux and containers Linux on Windows Windows on Windows All kinds of containers on Azure For dev/test and prod Containers on Windows 10 for devs Windows Server 2016 or Azure Container Service for prod Nano Server = Windows OS for the cloud Higher hosting density  lower costs Less updates and reboots  higher availability

Slide 29

Slide 29 text

Saves the day. Workshop Q&A Rainer Stropek software architects gmbh http://www.timecockpit.com [email protected] @rstropek Thank you for attending! Web Mail Twitter