Download presentation
Presentation is loading. Please wait.
Published byErik Allen Modified over 6 years ago
1
Microservices, Docker, .NET, Windows, Linux, Azure. Oh, My!
ARC326 Richard Banks
2
About me… TL;DR Version
I’m Richard (Banks). @rbanks54
3
We’ll cover… The Docker basics Windows and Linux Containers
Dockerising existing .NET code Docker & Microservices Deploying Containers & Azure Container Service
4
Docker in Under 5 Minutes
5
Terminology Image – a read only template for a container.
Container – a runnable instance of an image. Host –runs the Docker engine. Repository – stores Docker images. Registry – for sharing images, backed by repository(s). Bundle* – A distributable collection of images. Stack* – A running instance of a bundle.
6
Microsoft Ignite 2016 7/17/2018 4:43 PM Concepts realignment Containers are immutable infrastructure. Application & Environment are a single, deployable unit. You no longer promote binaries to production. You promote your container images. © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
7
You don’t upgrade applications in containers. You replace them.
8
Simpler DevOps Devs can control the environment for their apps.
“Works on my machine” now means “works on all machines”. IT Pros don’t have to worry about privilege elevation, running installers, or conflicting apps on the same machine. They can adopt a “cattle not pets” approach.
9
Developer’s Flow Install the Docker engine locally.
Write your app using your favourite tools. Create a container image for your app. Run it and test it locally. Push it to an image repository.
10
ITPro/Ops Flow Deploy Docker hosts and clusters.
Deploy an image repository Configure and run containers on hosts using images from the repository. Monitor containers for health.
11
Windows or Linux?
12
With great choice comes great confusion
Docker supports both Windows and Linux containers. Q: So what do I use? Docker on Linux is the more mature choice. Docker on Windows is (rapidly) improving. *Containers must run on hosts of the same O/S type.
13
Decision Matrix for .NET Applications
Keep using .NET Framework when: You already use .NET Framework and/or have strong dependencies on Windows You want to avoid the cost of porting to .NET Core. You use 3rd party libs not available in .NET Core. You need .NET features not available in .NET Core
14
Decision Matrix for .NET Applications
You should use .NET Core when: You have cross-platform needs or desires. Your architecture is based on microservices. You need best-in-class high performance and hyper-scale. (via
15
Decision Matrix for Ops Teams
Do I run Windows or Linux hosts? Does your team have sufficient knowledge of Linux? Would you be happy running containers via a service instead (e.g. Azure Container Service)? Are you organisationally constrained in platform choice? Can you support both platforms?
16
Dockerising existing .NET code
17
I have an existing .NET app
How do I run Docker locally? Do I use a Windows or Linux container? How do I create an image for it? How do I run it? Debug it?
18
Creating Images Images are layered snapshots of a file system. Steps:
Start with a base image (the first layer) Add your changes (each change is a new layer) Tag your final layer. Wallah!
19
Let’s Dockerise NerdDinner
20
What we need for the NerdDinner image
Start with a Windows Server Core base image Add IIS Add ASP.NET and .NET Framework --- Microsoft has done these for us already (microsoft/aspnet)
21
What we need for the NerdDinner image
Add SQL 2012 Express Local DB Add Application Code Configure the IIS App Pool & expose a port Run a container using the image
22
Open port 8081 & configure IIS app pool
Add NerdDinner code Install SQL 2012 Express Add ASP.NET and .NET Framework Install IIS Windows Server Core
23
Dockerfiles A dockerfile scripts the steps needed to build an image.
They make building fresh images an automated, repeatable and painless process. You can manually configure a running container and then snapshot it to create an image. Not recommended.
24
Demo
25
So what about Linux?
26
Considerations Do you want to port to .NET core or Mono?
Are you starting from scratch? Do you want to use any Linux based images from hub.* or store.docker.com (e.g. redis, elasticsearch, rabbitmq)? Linux containers are much easier to work with for now.
27
Let’s use Docker’s voting sample app
28
Demo
29
Now for the Ops Side
30
Deployment with containers
Single container & single host Devs commit code Build server creates and tags a new docker image Push the image to a repository
31
Continued… Single container & single host
Ops pulls the image from the repo on to a host Starts a container using the image, supplying config settings via command line or environment variables, if needed.
32
You can host your own container registry
Or you can use one provided by Azure
33
What happens when it’s more complex?
What if we have multiple hosts? What if we want to distribute load across the hosts? How do we manage storage? Can we manage container placement?
34
What happens if it’s more complex?
Can we autoscale container instances? Can we auto restart a container if it stops? Can we replace containers without downtime? Can we upgrade the docker engine without downtime?
35
A note on Stateful Applications
Docker’s VOLUME command lets us map a folder on the host into the container. But what happens if the container needs to be moved to a new host? What happens if multiple containers need to share the storage?
36
Docker Volumes Data Volumes exist outside the container file system.
Volumes still map to files on the hosts file system. You’ll need to place volumes on network shares or use tools like flocker to support host independent storage.
37
Enter orchestration tools
3 popular choices Docker Swarm (and Docker Datacentre) Kubernetes DC/OS (aka mesos, mesosphere, marathon) Azure and AWS container services offer one or more of these orchestration engines for use.
38
Swarm A peer-to-peer cluster of hosts, coordinating their efforts.
Use docker swarm to manage the cluster. The swarm itself appears like a normal Docker host to clients (e.g. docker cli commands) Hosts in the swarm can use different O/Ses Yes, windows hosts & linux hosts can be in the same swarm.
39
Swarm pros/cons Supports up to 1200 nodes and is provided by Docker, making it the “default” option. Lacks features like autoscaling, health checks, balancing, host migrations and management dashboards*
40
Swarms and Azure You can deploy a swarm via Azure Container Service
You can also deploy one using a template from Docker.
41
Demo
42
Kubernetes Part of the Linux Foundation, contributed by Google.
Similar concept to Swarm, but with more features and more support from dashboard providers. Use Minikube ( to run a single-node cluster locally
43
DC/OS Open sourced by Apache (Mesosphere is the Enterprise DC/OS toolkit). Similar feature set to Kubernetes, with a focus to support a wider range of workloads. Azure Container Services supports all 3 options for orchestration. Experiment with them to find the one best suited to your needs.
44
Recap The Docker basics The Developer & IT Pro perspectives
Dockerising existing .NET code Running heterogenous code Windows & Linux Containers Container orchestration
45
Fin.
46
Continue your Ignite learning path
7/17/2018 4:43 PM Continue your Ignite learning path Visit Channel 9 to access a wide range of Microsoft training and event recordings Head to the TechNet Eval Centre to download trials of the latest Microsoft products Visit Microsoft Virtual Academy for free online training visit © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
47
Win a Spark After Dark drone pilot pass by completing your session evaluation ASAP #MSAUIGNITE
48
Thank you Chat with me in the Speaker Lounge Find me @rbanks54
7/17/2018 4:43 PM Thank you Chat with me in the Speaker Lounge Find © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.