Docker for .NET Developers 2018 (60 min)

Docker for .NET Developers 2018 (60 min)

Slides from the 60 minute version of my Docker for .NET Developers talk.

863d6186d3bc32b7c9036101c47d5d5b?s=128

Steve Gordon

April 19, 2018
Tweet

Transcript

  1. 1.

    Technology that unlocks the value of your professional audience Docker

    for .NET Developers Steve Gordon - Senior Software Developer Madgex Ltd @stevejgordon | stevejgordon.co.uk youtube.stevejgordon.co.uk https://www.meetup.com/dotnetsoutheast
  2. 2.

    Technology that unlocks the value of your professional audience What

    we’ll cover • Our journey To Docker • Why use Docker? • What is Docker? • dockerfiles and docker-compose • Using Jenkins for builds • Running containers on AWS ECS
  3. 3.

    Technology that unlocks the value of your professional audience What

    is Docker? • Containerisation and application platform • Offers frictionless development and deployment • An image is a template for a container • Images are lightweight, standalone packages for an application • A container is a running instance of an image • A host is a physical or virtual machine on which you will run containers (running the Docker Engine)
  4. 4.

    Technology that unlocks the value of your professional audience Lightweight

    Significantly smaller resource footprint Small unit of deployment Smaller file size Containers vs. Virtual Machines PHYSICAL HOST HOST OS DOCKER ENGINE BINS / LIBS APP A BINS / LIBS APP C BINS / LIBS APP B Reliability Trust that what worked locally will work in production Fast start-up Can start in under 1 second PHYSICAL HOST HOST OS HYPERVISOR GUEST OS GUEST OS BINS / LIBS BINS / LIBS APP B APP A APP C
  5. 5.

    Technology that unlocks the value of your professional audience Microservice

    based Single responsibility Discrete scaling Independent releases .NET Core & ASP.NET Core Cross platform Improved performance API driven SPA Backend ASP.NET Core APIs Madgex Insights
  6. 6.

    Technology that unlocks the value of your professional audience Insights

    Architecture FRONT END SPA USER API SCHEDULE API REPORT API QUERY API ELASTICSEARCH
  7. 7.

    Technology that unlocks the value of your professional audience Developer

    Workflow PULL CLIENT PROJECT PULL PLATFORM BUILD x2 EDIT DOCKER-COMPOSE PULL EDIT DOCKER-COMPOSE UP
  8. 8.

    Technology that unlocks the value of your professional audience “This

    is amazing!” James Wragg (Senior Front End Developer at Madgex)
  9. 9.

    Technology that unlocks the value of your professional audience Developing

    with Docker On Windows • Docker for Windows (Win 10 Pro) • Docker Toolbox (Win 7 / Win 8 / Win 10 Home) On Mac • Docker for Mac (OS X El Capitan 10.11 or newer) • Docker Toolbox Visual Studio • Visual Studio Tools for Docker VS Code • Install the vscode-docker extension
  10. 10.
  11. 11.

    Technology that unlocks the value of your professional audience Anatomy

    of an image – ASP.NET Core 2.0 Build Image FILE SYSTEM – DEBIAN STRETCH - debian:stretch (45MB) DEPENDENCIES (PACKAGES) – CURL - buildpack-deps:stretch-curl (61MB) DEPENDENCIES (PACKAGES) – SCM - buildpack-deps:stretch-scm (111MB) .NET CORE SDK AND CLI - microsoft/dotnet:2.0.6-sdk-2.1.104-stretch (580MB) ASP.NET CORE NUGET PACKAGE CACHE - microsoft/aspnetcore-build:2.0 (699MB) YOUR ASP.NET APPLICATION SCRATCH
  12. 12.

    Technology that unlocks the value of your professional audience Naming

    and Tagging Images registry-prefix/name:tag • We can optionally name and tag images during build using –t or --tag • Image names can contain lowercase letters, digits and separators • Image names can be optionally prefixed with a registry hostname • A tag can be used to specify a “version” of an image e.g. myservice:1.02 • You can tag a pre-existing image using the docker image tag command
  13. 13.

    Technology that unlocks the value of your professional audience Images

    pushed to a registry Store for images Docker Registries Images pulled from a registry REGISTRY 123456789012.dkr.ecr.eu-west-2.amazonaws.com docker push 123456789012.dkr.ecr.eu-west-2.amazonaws.com/myimage:1.1 docker pull123456789012.dkr.ecr.eu-west-2.amazonaws.com/myimage:1.1
  14. 14.

    Technology that unlocks the value of your professional audience Demo

    docker-compose Build and run multiple images
  15. 15.
  16. 16.

    Technology that unlocks the value of your professional audience Orchestration

    • Tool(s) to assist with the management of multiple containers • Automated deployment with rollback support • Scaling • Health monitoring and healing of failed containers • Service discovery • Load balancing • Configuration management
  17. 17.

    Technology that unlocks the value of your professional audience Amazon

    ECS Services Manage how tasks run and scale. ALB CLUSTER EC2 INSTANCE ECS AGENT TASK A TASK B EC2 INSTANCE ECS AGENT TASK A TASK B TASK B SERVICE A Desired Count = 2 Task Def = Task Def A SERVICE B Desired Count = 4 Task Def = Task Def B Task Definition A recipe to execute your application TASK B ECS is a Managed Service No patching or maintenance Cluster Logical grouping of EC2 instances ALB ALB with path routing to multiple services Task A running instance of a task definition
  18. 18.

    Technology that unlocks the value of your professional audience Demo

    Deploying to AWS ECS using Docker and Jenkins
  19. 19.

    Technology that unlocks the value of your professional audience Zero

    Downtime Deployments CLUSTER EC2 INSTANCE TASK A ServiceA : v2 EC2 INSTANCE TASK A ServiceA : v3 SERVICE A Desired Count = 1 Task Def = Task Definition A TASK DEFINITION A Task Definition A : 3 Task Definition A : 2 Task Definition A : 1 ECR ServiceA : v1 ServiceA : v2 ServiceA : v3
  20. 20.

    Technology that unlocks the value of your professional audience Challenges

    and lessons learnt • There is a learning curve… but it's shallow at first • Start with basic dockerfiles – enhance in stages • Get started just by using a pre-built image e.g. Postgres • Amazon ECS a little complex • Use CloudFormation to define ECS environments • Vendor Lock • Logging • Placement of containers – Balance memory/memory reservation
  21. 21.

    Technology that unlocks the value of your professional audience Benefits

    • Improved developer productivity and reduced onboarding time • No more "it runs on my machine" arguments • Dependable deployments • Simple build and deploy process • Zero downtime, fast, continuous deployments • Lower costs
  22. 22.

    Technology that unlocks the value of your professional audience Thank

    you @stevejgordon | stevejgordon.co.uk https://www.meetup.com/dotnetsoutheast