There is already significant momentum in the industry toward building applications for containerized environments - with Docker leading the way. If you don’t develop applications with containers and micro services architecture in mind, rest assured you will. This session will provide a look at the designing, developing, and deploying distributed applications to Docker on Azure - including a look at the ecosystem of resources and tools like Docker Hub, Kubernetes, and Swarm.
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Docker and Azure: Design, Deploy, and Scale
1.
2. Docker and Azure: Design, Deploy,
and Scale
Michele Leroux Bustamante
Cofounder, Solliance
Cloud / Security Architect
michelebusta@solliance.net
3. What’s the plan?
• Discuss what’s available on Azure for Docker
• How do you create, deploy and run containers?
• What does scaling look like?
• Where are things heading?
4. Virtualization vs. Containerization
VM
OS
Docker Engine
VM
Host OS
Hypervisor
Guest OS Guest OS Guest OS
Binaries Binaries Binaries
App A App B App B
Binaries Shared Binaries
App A App B App B
Container
NOT
a Container
5. Virtualization vs. Containerization
VM
OS
Docker Engine
VM
Host OS
Hypervisor
Guest OS Guest OS Guest OS
Binaries Binaries Binaries
App A App B App B
Binaries Shared Binaries
App A App B App B
No OS
OS
Fast
Efficient
Simple
Practical
8. ###DEMO1: REFERENCE
### Local Docker illustration
#Run a Ghost container based on the latest Docker Hub image
#Browse to site at virtual box IP:PORT
###Commands:
$ docker images
$ docker ps
$ docker stop ghost
$ docker run ghost
9. Docker and Azure
• VM templates
• Support for Docker on Linux or Windows VM
• Container images target the OS, cannot share
• Container Service
• Azure Container Service
• ARM templates to preconfigure environment
• Eventually containers as a first class citizen
• Eventually container orchestration built-in (Mesos)
• Comparable to:
• Amazon EC2 Container Service
• Google Container Service
10. Azure VM Templates
• Create Linux or Windows VM with Docker installed
• Docker VM Extension
• Docker CLI commands are the same on Windows!
14. Images and Containers
• Images are created from
• Dockerfile
• Repository
• Create one from a container
• Containers are based on an image
• Run a container, stop, start, etc.
15. DEMO 2: Create, tag, publish image -> run
• Build an image from a Dockerfile
• Tag an image, for versioning
• Publish an image to Docker Hub
• Run a container from published image
• Update an image, apply tag, publish an update
16. ###DEMO2 REFERENCE
#build image, push to docker hub, run container
#Create a Linux VM with Docker installed
###Building from the machine
#Navigate to repo for Docker Hub /dasblonde/editdemo, review files
#Build the image, tag it, push it to Docker Hub
$ docker build --no-cache -t dasblonde/editdemo .
$ docker tag dasblonde/editdemo:latest dasblonde/editdemo:v1
$ docker push dasblonde/editdemo
#Show Docker Hub registry
$ docker run -d --name editdemov1 -p 8080:8080 dasblonde/editdemo:v1
#Browse to machine at port 8080
17. ###DEMO2 REFERENCE (2/2)
#version image, publish update, run container from versioned image
#Update Dockerfile to create from base v1 image and modify
$ docker build -t dasblonde/editdemo:v2 -f DockerfileUpdateToV2 .
#Review images, note latest points at v1
$ docker tag -f dasblonde/editdemo:v2 dasblonde/editdemo:latest
$ docker push dasblonde/editdemo
#Note updates to Docker Hub versions
#Run new version
$ docker run -d --name editdemov2 -p 8081:8080 dasblonde/editdemo:v2
18. DEMO 3: Access container, modify, run
• Log in to container on Docker VM
• Modify a file
• Save, exit, run container
19. ###DEMO3 REFERENCE
#Access container, modify files, run container with changes
### connect to the container, modify file, exit
$ docker exec -ti editdemov2 /bin/bash
$ vi FILENAME
$ CTRL + D
### commit container changes to a new image v3, tag it
$ docker commit –m “installed VIM” editdemov2 dasblonde/editdemo:v3
$ docker tag -f dasblonde/editdemo:v3 dasblonde/editdemo:latest
### push images to Docker Hub
$ docker push dasblonde/editdemo
### create and run container v3
$ docker run -d --name editdemov3 -p 8082:8080 dasblonde/editdemo:v3
20. DEMO 4: compose multiple containers
• ASSUMPTION: Docker Compose is installed
• Create a yml file to compose containers
• Example:
• Node.js client, external port
• Redis cache service, internal port
21. ### Install docker-compose if not available
# NOTE: Compose 1.4.2 requires Docker 1.7.0 or later
$ curl -L https://github.com/docker/compose/releases/download/1.4.2/docker-compose-
`uname -s`-`uname -m` > /usr/local/bin/docker-compose
$ chmod +x /usr/local/bin/docker-compose
22. ###DEMO4 REFERENCE
### navigate to yml folder, create and start containers
$ docker-compose up –d
### stop / start /restart containers
$ docker-compose stop
$ docker-compose start
$ docker-compose restart
### view logs
$ docker-compose logs
### browse to container, app is deployed
23. Orchestration
• Orchestrators schedule deployments usually across a cluster
• For example:
• Swarm and Compose (Docker)
• Kubernetes (Google)
• Mesos + Swarm, Chronos, Marathon (Mesosphere)
24. Clustering with Swarm
• ARM templates available to kick start
• Simple cluster template
• Single swarm master
• Multiple agent nodes (3)
• Clustered swarm template
• Multiple swarm master/slave topology (3)
• Multiple agent nodes (3)
25. DEMO 5: Deploying to a cluster with swarm
• SETUP:
• Provision Azure with ARM template
• Swarm master node
• Agent nodes each have swarm agent running
• Deploy to swarm master
• View provisioned containers across cluster
• View information about the cluster
26. ###DEMO5 REFERENCE
# deploy to swarm from remote machine
# or could access swarm master and do from that machine
### what’s in the swarm?
### replace IP with your swarm DNS
docker -H tcp://0.0.0.0:2376 ps
docker -H tcp://0.0.0.0:2376 info
### deploy something, ghost on swarm
docker -H tcp://0.0.0.0:2376 run -d ghost
### deploy more, another ghost, redis etc
# note swarm decides how to allocate based on cluster resources
27.
28. Containers / Microservices on Azure
• Now:
• Linux VMs
• Windows Server Container VMs
• Container Templates
• Container / VM Clustering Templates
• Future:
• Hyper-V Containers
• Azure Container Service
• Container Resources
• Mesosphere Data Center Operating System (DCOS)
• Service Fabric
29.
30. DCOS
• See 7 minute demo at Mesosphere site regarding DCOS
• Very impressive vision regarding container orchestration, scale and
disaster recovery
31. About Michele
Michele Leroux Bustamante
michelebusta@solliance.net
@michelebusta
Solliance Cofounder
Cloud / Security Architect
Microsoft Regional Director since 2003
Microsoft MVP – Microsoft Azure
Azure Elite, Azure Insider
32. Glöm inte att utvärdera sessionen direkt i
Microsoft TechDays-appen!