Book Image

Docker for Developers

By : Richard Bullington-McGuire, Andrew K. Dennis, Michael Schwartz
2 (1)
Book Image

Docker for Developers

2 (1)
By: Richard Bullington-McGuire, Andrew K. Dennis, Michael Schwartz

Overview of this book

Docker is the de facto standard for containerizing apps, and with an increasing number of software projects migrating to containers, it is crucial for engineers and DevOps teams to understand how to build, deploy, and secure Docker environments effectively. Docker for Developers will help you understand Docker containers from scratch while taking you through best practices and showing you how to address security concerns. Starting with an introduction to Docker, you’ll learn how to use containers and VirtualBox for development. You’ll explore how containers work and develop projects within them after you’ve explored different ways to deploy and run containers. The book will also show you how to use Docker containers in production in both single-host set-ups and in clusters and deploy them using Jenkins, Kubernetes, and Spinnaker. As you advance, you’ll get to grips with monitoring, securing, and scaling Docker using tools such as Prometheus and Grafana. Later, you’ll be able to deploy Docker containers to a variety of environments, including the cloud-native Amazon Elastic Kubernetes Service (Amazon EKS), before finally delving into Docker security concepts and best practices. By the end of the Docker book, you’ll be able to not only work in a container-driven environment confidently but also use Docker for both new and existing projects.
Table of Contents (21 chapters)
1
Section 1: An Introduction to Docker – Containers and Local Development
6
Section 2: Running Docker in Production
14
Section 3: Docker Security – Securing Your Containers

What this book covers

Chapter 1, Introduction to Docker, provides some background on Docker, a walk-through of containers and their purpose, and presents the reader with an introduction to the topics that will be discussed in the book.

Chapter 2, Using VirtualBox and Docker Containers for Development, guides the reader through using a virtual machine locally for development and then compares this to how Docker can be used for containerized development projects.

Chapter 3, Sharing Containers Using Docker Hub, introduces the reader to Docker Hub and pre-built containers. Next, we explore the process of building specialized containers.

Chapter 4, Composing Systems Using Containers, investigates more complex situations where multiple containers need to work together as a complete system. Additionally, we give the reader an overview of Docker Compose.

Chapter 5, Alternatives for Deploying and Running Containers in Production, helps the reader understand the spectrum of choices when it comes to running containers in a production environment, including cloud options, on-premises and hybrid solutions.

Chapter 6, Deploying Applications with Docker Compose, discusses how to deploy a production application on a single host with Docker Compose and how to deal with logging and monitoring, along with the pros and cons of this simple setup.

Chapter 7, Continuous Deployment with Jenkins, shows how to use Jenkins for continuous integration (CI) and continuous deployment (CD) for containers, using a Jenkinsfile and multiple development branches.

Chapter 18, Deploying Docker Apps to Kubernetes, explores Kubernetes concepts, cloud distribution options, and shows how to create an Amazon Web Services Elastic Kubernetes Service (EKS) cluster for deploying Docker applications to Kubernetes.

Chapter 9, Cloud-Native Continuous Deployment Using Spinnaker, builds upon the skills we developed around CI/CD by integrating Netflix's Spinnaker with Kubernetes and looking at automated tests.

Chapter 10, Monitoring Docker Using Prometheus, Grafana, and Jaeger, explains how to monitor container-based applications using AWS CloudWatch, Prometheus, and Grafana. We introduce the OpenTracing API and implement it using Jaeger.

Chapter 11, Scaling and Load Testing Docker Applications, explores how to scale a Docker-based application through Kubernetes. It introduces the concept of a service mesh and shows a simple implementation using Envoy, integrating load balancing and advanced traffic routing and filtering, including utilization of the circuit breaker pattern. Finally, we show how to use k6.io to perform load testing to demonstrate that our application can scale out.

Chapter 12, Introduction to Container Security, walks the reader through basic container security concepts, including how virtualization and hypervisor security models work.

Chapter 13, Docker Security Fundamentals and Best Practices, builds upon the previous chapter's introduction and delves deeper into Docker and security components. This includes a comparison of Docker commands and their security implications.

Chapter 14, Advanced Docker Security – Secrets, Secret Commands, Tagging, and Labels, covers the topics of secrets, including passwords, and how they can be used securely with container-based environments. The reader is also introduced to the use of tagging and labeling best practices.

Chapter 15, Scanning, Monitoring, and Using Third-Party Tools, expands upon our logging and monitoring skills acquired from other chapters by refocusing on these elements from a security focus. Here, we also look at what options are available for users of AWS, Azure, and GCP and how we can scan containers for security issues using Anchore.

Chapter 16, Conclusion – End of the Road, but not the Journey, wraps the book up by revisiting what we have learned so far. Finally, we provide some ideas for where the reader can go next in exploring container-based projects. This ranges from adding Netflix Chaos Monkey to their CI/CD pipeline, to running Metasploit in a container.