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
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)
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
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
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
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
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
• 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
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
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
• 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