Microsoft Azure has multiple options for running Windows containers in the cloud. We'll look at two from opposite ends of the complexity spectrum - Azure Container Instances and Azure Kubernetes Service.
Here it is on YouTube - ECS-W3: Running Windows Containers in the Cloud with ACI and AKS
-
Episode 15 of Learn Docker in a Month of Lunches - Building Docker images that run anywhere: Linux, Windows, Intel & Arm
You'll need the Azure CLI to follow along with the Azure Demos.
You'll need the Edge release of Docker Desktop to follow the other demos.
You'll also need an Azure account :)
Open the ACI blade.
Configure a new deployment:
Container name: sql-server
Image: docker4dotnet/sql-server:2017
OS type: Windows
Memory (GiB): 2
Number of CPU cores: 1
---
Ports: 1433
DNS name label: sql-ecs-w3
---
Environment: sa_password=DockerCon!!!
Check the deployment - container image will take a while to pull...
It's using a large Server Core image: https://hub.docker.com/r/docker4dotnet/sql-server/tags
Use the command line to create a container from a Nano Server image
az container create `
-g ecs-w3 --name whoami `
--image diamol/ch16-whoami --os-type Windows `
--cpu 1 --memory 1.5 `
--ports 80 --dns-name-label ecs-w3-2
Browse to portal - SQL container should be running, connect with Sqlectron
Check the Whoami app at http://ecs-w3-2.eastus.azurecontainer.io
Create a Docker context to manage ACI containers:
docker login azure
docker context create aci ecs-w3 # select RG
Switch to the ACU context and check running containers:
docker context ls
docker context use ecs-w3
docker ps
docker logs whoami_whoami
Create a new container:
docker run -d -p 80:80 --name whoami2 diamol/ch16-whoami
docker ps
Check with
curl
- Linux
Try to create a Windows container:
docker run -d -p 80:80 --name whoami3 diamol/ch16-whoami:windows-amd64
docker run --help
Fails - ACI integration is in beta
Teardown
docker rm -f $(docker ps -aq)
docker compose down --project-name sql-server
docker compose down --project-name whoami
Refresh portal
Open the AKS blade
New AKS cluster:
- Add Node pool
- OS=Windows
- Node count
- Node size
Create cluster with az
:
az aks create -g ecs-w3 -n ecs-aks `
--node-count 2 --kubernetes-version 1.17.11 `
--load-balancer-sku Standard --network-plugin azure `
--windows-admin-username kube --windows-admin-password "--generated-password--"
Add Windows nodes:
az aks nodepool add `
--resource-group ecs-w3 `
--cluster-name ecs-aks `
--os-type Windows `
--name akswin `
--node-count 2 `
--kubernetes-version 1.17.11
Get creds:
az aks get-credentials --resource-group ecs-w3 --name ecs-aks
kubectl get nodes
The demo app is the .NET 3.5 PetShop from 2008...
Source code for the app is in sixeyed/petshopvnext
Walk through the YAML specs in ecs-w3/aks
.
Deploy the Nginx Ingress Controller:
kubectl get ns
cd episodes/ecs-w3
kubectl apply -f aks/ingress-controller/
kubectl get pods -n ingress-nginx
Deploy the Petshop app:
kubectl apply -f aks/petshop/
kubectl get pods -n petshop
kubectl get svc -n ingress-nginx
Browse to the external IP
ECS-W4: Isolation and Versioning in Windows Containers