Book Image

Docker on Windows - Second Edition

By : Elton Stoneman
Book Image

Docker on Windows - Second Edition

By: Elton Stoneman

Overview of this book

Docker on Windows, Second Edition teaches you all you need to know about Docker on Windows, from the 101 to running highly-available workloads in production. You’ll be guided through a Docker journey, starting with the key concepts and simple examples of .NET Framework and .NET Core apps in Docker containers on Windows. Then you’ll learn how to use Docker to modernize the architecture and development of traditional ASP.NET and SQL Server apps. The examples show you how to break up legacy monolithic applications into distributed apps and deploy them to a clustered environment in the cloud, using the exact same artifacts you use to run them locally. You’ll see how to build a CI/CD pipeline which uses Docker to compile, package, test and deploy your applications. To help you move confidently to production, you’ll learn about Docker security, and the management and support options. The book finishes with guidance on getting started with Docker in your own projects. You’ll walk through some real-world case studies for Docker implementations, from small-scale on-premises apps to very large-scale apps running on Azure.
Table of Contents (18 chapters)
Free Chapter
1
Section 1: Understanding Docker and Windows Containers
6
Section 2: Designing and Building Containerized Solutions
10
Section 3: Preparing for Docker in Production
14
Section 4: Getting Started on Your Container Journey

What this book covers

Chapter 1, Getting Started with Docker on Windows, introduces the Docker runtime and walks through the options for running Docker on Windows, covering Windows 10 and Windows Server 2019, and running Docker on an Azure virtual machine (VM).

Chapter 2, Packaging and Running Applications as Docker Containers, focuses on the Docker image—a packaged application with all its dependencies that will run in the same way on any host that can run Docker. You'll see how to build Docker images with a Dockerfile for a simple website, and then run it on Windows.

Chapter 3, Developing Dockerized .NET Framework and .NET Core Applications, shows how you can containerize existing .NET Framework applications and run them in Windows containers, and use the same approach for new .NET Core applications, which can run on any operating system. .NET Core apps run equally well on Windows and Linux, and they are ideally suited for packaging into a portable Docker container.

Chapter 4, Sharing Images with Docker Registries, covers Docker Hub where built images can be shared, including official images from product teams, public community images, and private repositories. You'll learn how to publish the images you build in development, how to run your own private Docker registry for internal use, and about commercial registry solutions with added features.

Chapter 5, Adopting Container-First Solution Design, builds on the previous chapters, showing how the range of high-quality Docker images makes it straightforward to design distributed solutions, mixing off-the-shelf images with custom ones. You'll learn how to break down a legacy monolithic app, replacing the home page and adding a REST API, together with new analytics features with Elasticsearch and Kibana—all in Windows containers.

Chapter 6, Organizing Distributed Solutions with Docker Compose, takes the ad-hoc distributed solution and builds it into a deployable package using Docker Compose with a Docker network, so our containers can communicate using DNS. You'll understand the structure of the Docker Compose YAML file and the runtime for Docker Compose. You'll also have an overview of Docker networks, seeing how easy it is to connect containers together.

Chapter 7, Orchestrating Distributed Solutions with Docker Swarm, covers production-ready clustering with Docker Swarm, focusing on the new clustering technology built into Docker. You'll learn how to set up a swarm running on Windows, explore how the routing mesh works, and look at service discovery and reliability by deploying distributed applications as swarm services.

Chapter 8, Administering and Monitoring Dockerized Solutions, covers management for distributed Docker solutions. You'll see you can use existing admin tools with Windows containers. You'll also look at a new way to manage containerized apps, using both free and commercial tools to visualize the containers in Docker Swarm, and learn how to do rolling upgrades of a running service.

Chapter 9, Understanding the Security Risks and Benefits of Docker, covers the key aspects of Docker security—the risks of having multiple containers on one node, the potential for an attacker to compromise one container and access others, and how to mitigate this. You'll learn how Docker improves security, with vulnerability scanning for images built into Docker Hub and Docker Trusted Registry, flagging security issues with the software inside images.

Chapter 10, Powering a Continuous Deployment Pipeline with Docker, covers Docker in a DevOps workflow, where everything is automated. We'll build out a whole deployment pipeline using Docker—running a Git server and a Jenkins automation server in containers for source control and builds. The pipeline will package a new Docker image when code is pushed, run automated tests, and deploy to a test environment.

Chapter 11, Debugging and Instrumenting Application Containers, looks at troubleshooting Docker containers during both build and run. You'll see how to use Docker with various versions of Visual Studio, and how to instrument applications and containers to show their current status on a dashboard. You'll also learn how Docker improves the bug-fixing workflow for developers.

Chapter 12, Containerize What You Know - Guidance for Implementing Docker, has a real-world focus. It covers putting forward a business case for Docker, and how to validate that the business case is met. You'll learn about containerizing existing software stacks in a proof-of-concept, and how to extract a vertical slice from an application that can run in Docker, moving towards a microservice architecture.