Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Docker All The Things - ASP.NET 4.x and Windows Server Containers


Published on

Docker is awesome and there's been a lot of excitement over .NET Core running in Linux containers. But why do older apps have to miss out on the fun? With Windows Server 2016 and Windows Server containers, there's finally a way to dockerize .NET 4.6 apps using the same Docker tools and commands as we're used to on Linux. In this intermediate level talk, I'll give an overview of Docker and Windows Server containers. Then I'll demonstrate different ways to run existing ASP.NET Web API, MVC, and even WebForms applications inside Docker containers.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Docker All The Things - ASP.NET 4.x and Windows Server Containers

  1. 1. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Dockerizing ASP.NET 4.x Apps Anthony Chu
  2. 2. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Containers Docker Windows Server Containers Dockerizing ASP.NET Hyper-V Containers, Windows 10
  3. 3. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Who's Anthony? Developer from Vancouver, BC Experimenting with Docker on Windows Microsoft MVP - Azure
  4. 4. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Typical Development Process Develop application locally Deploy to QA environment and test Deploy to production environment
  5. 5. @nthonyChu#SeattleCodeCamp #DockerAllTheThings The App Deployment Problem Environments must be kept the same “Works on my machine” Set up servers to run different types of apps Conflicts between dependency versions Long lived servers
  6. 6. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Infrastructure as Code Ephemeral infrastructure Easier to have consistently configured servers Code and configuration are separate
  7. 7. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Immutable Virtual Machines Create VMs as part of build process VM as a unit of deployment Devs build the app and configures environment Slow to start up Take up lots of resources
  8. 8. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Virtual Machines Infrastructure Host OS Virtual Machine Dependencies App Virtual Machine GuestOS Dependencies App GuestOS Containers Infrastructure Host OS Container Dependencies App Container Dependencies App
  9. 9. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Containers Kernel virtualization, host-level performance Consistently deployed by ops No longer a need for specially configured servers Can be deployed on same server or separate Devs responsible for building app and environment
  10. 10. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Containers By Patrick Denker from Athens, GA (DSC04878) [CC BY 2.0 (], via Wikimedia Commons
  11. 11. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Docker and containers Containers support existed in Linux for a while Docker made them accessible Common tooling
  12. 12. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Docker Tooling Docker Client Docker Engine Docker Machine Docker Compose Docker Swarm Docker Registry
  13. 13. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Docker and Linux Containers Linux Linux Docker Engine REST API Docker Client Docker Compose Docker Swarm more…
  14. 14. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Docker Images Container “templates” Images can be local Share with others using a registry (Docker Hub) Created manually or using a Dockerfile Can be tagged
  15. 15. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Operating System Images Basic building block “Clean install” of an OS Examples • ubuntu • debian • windowsservercore
  16. 16. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Dockerfile • Base image • Install dependencies • Build application • Specify entry point
  17. 17. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Dockerfile FROM ubuntu:14.04 RUN apt-get update && apt-get install -y ruby ruby-dev RUN gem install sinatra
  18. 18. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Docker Build $ docker build -t anthonychu/ruby:0.1.0 . $ docker push anthonychu/ruby:0.1.0
  19. 19. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Dockerfile FROM anthonychu/ruby:0.1.0 ADD . /src WORKDIR /src ENTRYPOINT [“ruby”, “foo.rb"]
  20. 20. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Docker Build $ docker build -t anthonychu/foo . $ docker run anthonychu/foo
  21. 21. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Containers Can only see its own files and processes Can set limits on resources used by a container
  22. 22. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Continuous Delivery Pipeline Docker Hub Dev QA Productionanthonychu/my-app:1.0
  23. 23. @nthonyChu#SeattleCodeCamp #DockerAllTheThings That’s Linux, but what about… ASP.NET WebForms? MVC, Web API, SignalR? Dependencies that require full .NET Framework? Don’t want to port to .NET Core?
  24. 24. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Windows Server Containers!
  25. 25. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Windows Server 2016 Current version is Technical Preview 5 Comes in 2 flavors • Windows Server • Nano Server Native support for containers
  26. 26. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Not Docker for Windows!
  27. 27. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Docker for Windows Windows Boot2Docker (Linux) on Hyper-V Docker Engine Docker Client
  28. 28. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Docker and Windows Server Containers Windows Windows Docker Engine REST API Docker Client Docker Compose Docker Swarm more…
  29. 29. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Demo
  30. 30. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Demo Windows Server 2016 and containers setup Docker basics Running a container
  31. 31. @nthonyChu#SeattleCodeCamp #DockerAllTheThings ASP.NET in containers Linux Windows Nano Server ASP.NET Core (.NET Core) ✔ ✔ ✔ ASP.NET Core (Full Framework) Mono ✔ Web API, SignalR (OWIN Self-host) ✔ WebForms, MVC 5 (IIS) ✔
  32. 32. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Demo
  33. 33. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Demo ASP.NET Web API OWIN self host microsoft/iis image ASP.NET WebForms in IIS
  34. 34. @nthonyChu#SeattleCodeCamp #DockerAllTheThings So… What’s the point of all this?
  35. 35. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Docker all the things Manage and deploy everything with Docker Run multiple .NET versions on same machine No more installing dependencies on servers
  36. 36. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Monolith to Microservices Dockerize monolith Spin off features into microservices in containers Repeat until monolith is obsolete Strangler Application Pattern •
  37. 37. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Mixed Linux/Windows Clusters Windows Container Linux Container
  38. 38. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Hyper-V Containers Windows 10
  39. 39. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Windows Server Containers Infrastructure Windows Server 2016 Container Dependencies App Container Dependencies App Utility VM Hyper-V Containers Infrastructure Windows Server 2016 / Windows 10 Container Dependencies App Utility VM Container Dependencies App
  40. 40. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Hyper-V Containers “Utility VM” - Only purpose is to run containers Fast startup Currently only Nano Server containers
  41. 41. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Hyper-V Containers Same images as Windows Server Containers Runtime option $ docker run --isolation=hyperv my-image
  42. 42. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Containers on Windows 10 Windows 10 Anniversary Update Support for Hyper-V containers only Instructions at
  43. 43. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Summary Docker and containers are a big deal Dockerize all ASP.NET applications Windows Server containers coming soon Manage Linux/Windows containers with same tools
  44. 44. @nthonyChu#SeattleCodeCamp #DockerAllTheThings Next Steps Try Windows Server 2016 Azure Container Services Windows Private Preview @nthonyChu