Saturday, November 12, 2016

Azure Container Service & Windows 10 Docker Lab

Azure Container Service: the cloud’s most open option for containers | Blog | Microsoft Azure

Hosting and scaling your apps with Azure Container Service - YouTube


Microsoft Lab Portal
"Build your first container using Docker on Hyper‑V
Free, hands‑on virtual lab
In this 30‑minute, hands‑on virtual lab, you will be guided through the basics of installing, deploying, and managing a Docker container as well as, fundamentals for incorporating Docker on Hyper‑V into your current development plans."

# open PowerShell as an admin
PS> Get-WindowsOptionalFeature -Online -FeatureName containers
PS> Get-WindowsOptionalFeature -Online -FeatureName *hyper*
PS> Restart-Computer -Force # maybe not needed?


PS> New-Item -Type Directory -Path $env:ProgramFiles\docker\
PS> [Environment]::SetEnvironmentVariable("Path", $env:Path + ";$env:ProgramFiles\docker", [EnvironmentVariableTarget]::Machine)
# close and re-open PowerShell as admin, to reload paths
PS> ipconfig # only one network adapter is present
PS> dockerd --register-service
PS> Start-Service Docker
PS> ipconfig # see multiple network adapters
PS> docker network ls


PS> docker network inspect nat

# installing Windows Nano Server
PS> Install-ContainerImage
PS> docker load -i C:\ContainerSource\nanoserver.tar.gz # 684 MB
PS> docker images
PS> docker tag microsoft/nanoserver:10.0.14393 nanoserver:latest
PS> docker images

PS> docker run -it --isolation=hyperv --name dockerdemo nanoserver cmd


> dir
> ipconfig
> ping dc01.contoso.com,

PS> docker ps

> exit  # this stops container

PS> docker ps  # nothing 
PS> docker ps -a  # includes nanoserver
PS> docker start dockerdemo
PS> docker attach dockerdemo # resume session

> ipconfig
> ipconfig > c:\ipconfig.txt,
> exit

PS> docker commit dockerdemo newcontainerimage
PS> docker images
PS> docker run -it --name newcontainer newcontainerimage cmd

> type c:\ipconfig.txt
> ipconfig # comes different IP address
> exit

PS> docker rm newcontainer
PS> docker rmi newcontainerimage
PS> docker images

PS> cd \build\iis
PS> type dockerfile
PS> docker build –t nanoserver_iis1 c:\build\iis
PS> docker images
PS> docker run -it --name iis1 nanoserver_iis1 cmd

> cd packages
> dism /online /apply-unattend:.\unattend.xml


> net start w3svc
> exit

PS> docker commit iis1 nanoserver_iis2
PS> if (!(Get-NetFirewallRule | where {$_.Name –eq “TCP80”})) { New-NetFirewallRule –Name “TCP80” –DisplayName “HTTP on TCP/80” –Protocol tcp –LocalPort 80 –Action Allow -Enabled True}
PS> docker run –it --name iiscontainer –p 80:80 nanoserver_iis2 cmd

IE>  http://10.10.10.41

No comments: