Book Image

Docker High Performance - Second Edition

By : Allan Espinosa, Russ McKendrick
Book Image

Docker High Performance - Second Edition

By: Allan Espinosa, Russ McKendrick

Overview of this book

Docker is an enterprise-grade container platform that allows you to build and deploy your apps. Its portable format lets you run your code right from your desktop workstations to popular cloud computing providers. This comprehensive guide will improve your Docker work?ows and ensure your application's production environment runs smoothly. This book starts with a refresher on setting up and running Docker and details the basic setup for creating a Docker Swarm cluster. You will then learn how to automate this cluster by using the Chef server and cookbooks. After that, you will run the Docker monitoring system with Prometheus and Grafana, and deploy the ELK stack. You will also learn best practices for optimizing Docker images. After deploying containers with the help of Jenkins, you will then move on to a tutorial on using Apache JMeter to analyze your application's performance. You will learn how to use Docker Swarm and NGINX to load-balance your application, and how common debugging tools in Linux can be used to troubleshoot Docker containers. By the end of this book, you will be able to integrate all the optimizations that you have learned and put everything into practice in your applications.
Table of Contents (16 chapters)
Title Page
Copyright and Credits
About Packt
Contributors
Preface
Index

Preface

Docker is an enterprise-grade container platform that allows you to build and deploy your apps. Its portable format lets you run your code anywhere, from your desktop workstation, to popular cloud computing providers. This book will help you realize the full potential of Docker.

In this book, you will learn a lot about how Docker works. You will learn the basics of Docker, along with some of the fundamental concepts of web operations. You will gain knowledge of Docker and the relevant operating system concepts to get a deeper understanding of what is happening behind the scenes. You will also learn a lot about the tools to deploy and troubleshoot our Docker containers in production in a scalable and manageable fashion.

 

Who this book is for

If you are a software developer with a good understanding of managing Docker services and the Linux file system, and are looking for ways to optimize working with Docker containers, then this is the book for you. Developers fascinated by containers and workflow automation will also benefit from this book.

What this book covers

Chapter 1, Preparing Docker Hosts, helps you familiarize yourself with Docker Engine and how to prepare a Docker host. We will then build a PKI to ensure secure communication between our Docker host and our Docker client workstation. We will also build a small Docker Swarm cluster, consisting of multiple Docker hosts.

Chapter 2, Configuring Docker with Chef, shows how to automate the configuration of our Docker deployments. We will also use Chef, a piece of configuration management software, to manage Docker hosts in scale.

Chapter 3, Monitoring Docker, helps us to understand the importance of monitoring and collecting metrics in Prometheus. We will also learn how to consolidate logs in an ELK stack.

Chapter 4, Optimizing Docker Images, discusses optimizing our Docker images and improving our development workflow. We will also learn to reduce image deployment time and improve image build time.

Chapter 5, Deploying Containers, looks at how we can use Jenkins to build, distribute, and deploy our containerized application. We will also learn to build and deploy a simple application using a three-stage pipeline.

Chapter 6, Benchmarking, helps us create benchmarks to gauge the performance of our Docker application.

Chapter 7, Load Balancing, talks about how to scale out our Docker applications to increase our capacity. We will use load balancers, which are a key component in the architecture of various web scale applications. We will also learn to balance load with NGINX.

Chapter 8, Troubleshooting Containers, inspects containers with Docker exec, and help us understand what debugging is, along with other container debugging tools.

Chapter 9, Onto Production, wraps up the book by teaching us how to perform web operations. We will also learn to deploy and scale our applications.

To get the most out of this book

  1. A Linux workstation with a recent kernel is needed to serve as a host for Docker CE 18.09.0. This book uses CentOS 7 as its base operating system to install and set up Docker.
  2. More details on how to get Docker up and running is covered in Chapter 1, Preparing Docker Hosts.

Download the example code files

You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packt.com/support and register to have the files emailed directly to you.

 

You can download the code files by following these steps:

  1. Log in or register at www.packt.com.
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub athttps://github.com/PacktPublishing/Docker-High-Performance-Second-Edition. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://www.packtpub.com/sites/default/files/downloads/9781789807219_ColorImages.pdf.

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "First, we will create a directory for our PKI and generate the CA's private key in a file called ca-key.pem."

A block of code is set as follows:

{
  "tlsverify": true,
  "tlscacert": "/etc/docker/ca.pem",
  "tlskey": "/etc/docker/server-key.pem",
  "tlscert": "/etc/docker/server.pem"
}

Any command-line input or output is written as follows:

dockerhost$ systemctl daemon-reload
dockerhost$ systemctl restart docker.service

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: " In the form field labeled Name, set the value to Unicorn Capacity."

Note

Warnings or important notes appear like this.

Note

Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packt.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packt.com.