2. What problem are we solving?
Hosting web apps is (increasingly) difficult
3. What is so difficult about hosting web apps?
● No web app is an island.
● We have a LOT of them now
● We want/need/expect to be able to run them in different
environments
● New technologies bring new requirements and
dependencies
We’re going to need more machines!!!
5. In the beginning...
We setup a server, configured it, and
copied our web app code to it.
Done!
6. But then… we had to scale
We moved the database to a separate
machine.
We added more machines and
introduced load balancing
Rinse and repeat.
7. There’s got to be a better way...
Virtual Machines!
Introduction of abstraction layer
between hardware and “machine”
(OS)
8. Mo machines mo problems
We still have to deal with hardware
● Hardware fails
● Hardware become obsolete
● Hardware is expensive. Buying for peak traffic.
We now have lots of VMs to maintain (patch,
upgrade, backup, etc)
9. To the cloud!!!
Dear Azure/AWS,
Please take care of the hardware for me.
XOXO
- Dev and Ops
Hooray! Now we can focus on what matters…
Virtual Machines and putting apps on them.
10. Mo VMs mo VM problems
With a taste of freedom from hardware constraints,
we get greedy….
Each web app should run in it’s own VM… per
environment
● Production (of course)
● Development
● On-Demand/Dynamic for feature branches
11. There’s got to be a better way...
Containers! (docker)
Abstraction layer between VM and Application
Decouples web apps (and their dependencies)
from the host (VM) machine
The SAME code runs everywhere
More efficient usage of resources ($!!!)
14. Docker. It's kinda like… Nuget
Images (Packages)
Public and Private Repositories
Push and Pull commands
15. Docker. It's kinda like… Git
Delta, Hashes and Layers
● Base Images contain the OS/Kernel
● New Images sit on top of base or parent
images and add/alter/delete features
○ Base Image ~ Master Branch
○ Image ~ Feature Branch with additional
commits.
● Layers/Images cached on hosts
16. Docker. It reminds me of… MP3s!?
Decouples application from VM and the VMs OS
It’s a standard. All containers must honor a docker contract so that they all work
the same way.
Small, portable, self-contained… this is a big deal.
17. Who is Docker?
Docker is a company that has open sourced the Docker container type and related
components. They make $ on support and premium services.
Supporters:
● Microsoft
● Google
● Amazon
● etc.
18. What is a Docker Image?
Summary
● An image is a lightweight, stand-alone, executable package of a piece of software.
● It includes everything needed to run it: code, runtime, system tools, system libraries, settings.
Where are Images stored?
● On public and/or private repos. The default repo is DockerHub.com.
● On any host machine that has pulled the package down from a repo.
● Images are designed to be composed of layers of other images. Thus, each layer is stored and
cached separately.
19. How do I make a custom Image?
Dockerfile
FROM microsoft/aspnet:4.7.1-windowsservercore-1709
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN Set-ExecutionPolicy Bypass -Scope Process -Force;
RUN Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'));
PS> docker.exe build --rm --tag allrecipes/aspnet-choco:4.7.1 --file dockerfile .
Commit an existing container
20. What is a Container?
To use a programming metaphor, if an image is a class, then a container is an
instance of a class. It’s a runtime object.
Where can I run containers?
● Windows 10, Windows Server 2016, macOS, Linux, Cloud…
● OS constraint
How do I run a container?
docker.exe run --name allrecipes/aspnet-choco:4.7.1 --it powershell
21. How do I compose a system of Containers?
Docker-compose
● YML file that specifies containers to include, their config, and
interdependencies
● Examples
22. How do I scale a system of Containers?
Welcome to Container Orchestration. Scale containers across multiple host (VM)
machines.
● Docker Swarm
● Kubernetes - Winner.
○ Again YML config file.
○ Scheduling
○ Secret management
○ Load balancing
○ Deployment strategies
23. Docker 101 - Recap
Images
● Created using Dockerfile
● Stored as a series of layers
● Stored in public and private repos
Container
● Instance of Image. Runtime object
● Transient in nature
Composition
● Config via .yml files
● Executes via Docker-Compose.exe
● Containers run on one host
Orchestration
● Kubernetes
● Scheduling, load-balancing, secrets
management
● Containers run in a cluster
25. Docker : Local Development
Requirements
● Windows 10 (Fall Creators Update) aka: v1709
● Docker for Windows - Windows and Linux containers and K8s
○ Beware: Fun with Macbook Pros
Tooling
● Visual Studio Code
● Visual Studio 2017
○ MembershipService demo
26. Docker : Discovery
Tech Evaluation and POC’ing
● Pre-configured, ready to run, applications in seconds
○ docker pull docker.bintray.io/jfrog/artifactory-oss:latest
○ docker run -p 8080:8080 jenkinsci/blueocean
○ docker run -d --name db -p 8091-8094:8091-8094 -p 11210:11210 couchbase
○ docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node"
docker.elastic.co/elasticsearch/elasticsearch:6.2.2
27. Docker and CI/CD Pipelines
Most major CI/CD software now supports Docker.
● VSTS, TeamCity, Jenkins
There are new CI/CD players that are “Docker First”
● CodeFresh, CodeShip, etc
...
“The Only Thing That Is Constant Is Change” ― Heraclitus
28. TeamCity… the future is NOW!
Note: The future is now (as of Feb 27th)
● Any command can be run within any docker image.
○ Without a single line of code being changed
○ Docker Image acts as the Build Agent … running… on… a Build Agent. I know.
● Dockerfile
○ Let’s get Dockerized!!! SearchService: Dockerfile
● Docker-Compose
○ The stuff of dreams… we’ll get there.
29. Docker : Production
The state of things:
● Windows Support lags behind Linux. *cough* dotnetcore *cough*
● Cloud Wars! Azure, AWS, and Google Cloud are fighting for business
○ Things are quickly getting better/easier
○ Managed Kubernetes is the current battle ground. AWS taking it one step further.
● Current Options:
○ AWS Elastic Container Service (ECS) or Azure Container Service (AKS)
■ Proprietary container orchestration
● The Dream
○ Managed Kubernetes in the cloud