Docker High Performance: Complete your Docker journey by optimizing your application's work?ows and performance, 2nd Edition
By Espinosa Allan and Russ McKendrick
()
About this ebook
Leverage Docker to unlock efficient and rapid container deployments to improve your development workflow
Key Features
- Reconfigure Docker hosts to create a logging system with the ElasticSearch-Logstash-Kibana (ELK) stack
- Tackle the challenges of large-scale container deployment with this fast-paced guide
- Benchmark the performance of your Docker containers using Apache JMeter
Book Description
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 Chef Server and Cookbook. After that, you will run the Docker monitoring system with Prometheus and Grafana, and deploy the ELK stack. You will also learn some tips 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.
What you will learn
- Automate provisioning and setting up nodes in a Docker Swarm cluster
- Configure a monitoring system with Prometheus and Grafana
- Use Apache JMeter to create workloads for benchmarking the performance of Docker containers
- Understand how to load-balance an application with Docker Swarm and Nginx
- Deploy strace, tcdump, blktrace, and other Linux debugging tools to troubleshoot containers
- Integrate Docker optimizations for DevOps, Site Reliability Engineering, CI, and CD
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 with containers and workflow automation with benefit from this book.
Related to Docker High Performance
Related ebooks
Docker High Performance Rating: 0 out of 5 stars0 ratingsDeveloping with Docker Rating: 5 out of 5 stars5/5Docker for Serverless Applications: Containerize and orchestrate functions using OpenFaas, OpenWhisk, and Fn Rating: 0 out of 5 stars0 ratingsBeginning DevOps with Docker: Automate the deployment of your environment with the power of the Docker toolchain Rating: 0 out of 5 stars0 ratingsMastering Docker: Unlock new opportunities using Docker's most advanced features, 3rd Edition Rating: 0 out of 5 stars0 ratingsExtending Docker Rating: 0 out of 5 stars0 ratingsLearn Docker – Fundamentals of Docker 19.x: Build, test, ship, and run containers with Docker and Kubernetes, 2nd Edition Rating: 0 out of 5 stars0 ratingsKubernetes for Developers: Use Kubernetes to develop, test, and deploy your applications with the help of containers Rating: 0 out of 5 stars0 ratingsDocker and Kubernetes for Java Developers Rating: 0 out of 5 stars0 ratingsLearning Docker: Build, ship, and scale faster Rating: 0 out of 5 stars0 ratingsDocker on Amazon Web Services: Build, deploy, and manage your container applications at scale Rating: 0 out of 5 stars0 ratingsDocker: Up and Running: Build and deploy containerized web apps with Docker and Kubernetes (English Edition) Rating: 0 out of 5 stars0 ratingsHands-On Microservices with Kubernetes: Build, deploy, and manage scalable microservices on Kubernetes Rating: 0 out of 5 stars0 ratingsMonitoring Docker Rating: 0 out of 5 stars0 ratingsPuppet for Containerization Rating: 0 out of 5 stars0 ratingsContainers in OpenStack: Leverage OpenStack services to make the most of Docker, Kubernetes and Mesos Rating: 0 out of 5 stars0 ratingsDocker on Windows Rating: 0 out of 5 stars0 ratingsThe Ultimate Docker Container Book: Build, test, ship, and run containers with Docker and Kubernetes Rating: 0 out of 5 stars0 ratingsHands-On Microservices with Node.js: Build, test, and deploy robust microservices in JavaScript Rating: 0 out of 5 stars0 ratingsHands-On Kubernetes on Windows: Effectively orchestrate Windows container workloads using Kubernetes Rating: 0 out of 5 stars0 ratingsDevOps with Kubernetes: Accelerating software delivery with container orchestrators, 2nd Edition Rating: 0 out of 5 stars0 ratingsHashiCorp Packer in Production: Efficiently manage sets of images for your digital transformation or cloud adoption journey Rating: 0 out of 5 stars0 ratingsLearn OpenShift: Deploy, build, manage, and migrate applications with OpenShift Origin 3.9 Rating: 0 out of 5 stars0 ratingsThe Kubernetes Bible: The definitive guide to deploying and managing Kubernetes across major cloud platforms Rating: 4 out of 5 stars4/5A Developer's Essential Guide to Docker Compose: Simplify the development and orchestration of multi-container applications Rating: 0 out of 5 stars0 ratings
System Administration For You
Linux: Learn in 24 Hours Rating: 5 out of 5 stars5/5Learn PowerShell in a Month of Lunches, Fourth Edition: Covers Windows, Linux, and macOS Rating: 5 out of 5 stars5/5Practical Data Analysis Rating: 4 out of 5 stars4/5Ethical Hacking Rating: 4 out of 5 stars4/5Cybersecurity: The Beginner's Guide: A comprehensive guide to getting started in cybersecurity Rating: 5 out of 5 stars5/5Mastering Windows PowerShell Scripting Rating: 4 out of 5 stars4/5Learn Git in a Month of Lunches Rating: 0 out of 5 stars0 ratingsPowerShell: A Beginner's Guide to Windows PowerShell Rating: 4 out of 5 stars4/5Linux Commands By Example Rating: 5 out of 5 stars5/5Learning Microsoft Endpoint Manager: Unified Endpoint Management with Intune and the Enterprise Mobility + Security Suite Rating: 0 out of 5 stars0 ratingsBash Command Line Pro Tips Rating: 5 out of 5 stars5/5CompTIA A+ Complete Review Guide: Core 1 Exam 220-1101 and Core 2 Exam 220-1102 Rating: 5 out of 5 stars5/5The Complete Powershell Training for Beginners Rating: 0 out of 5 stars0 ratingsLinux Command-Line Tips & Tricks Rating: 0 out of 5 stars0 ratingsPowerShell: A Comprehensive Guide to Windows PowerShell Rating: 4 out of 5 stars4/5Linux Bible Rating: 0 out of 5 stars0 ratingsWordpress 2023 A Beginners Guide : Design Your Own Website With WordPress 2023 Rating: 0 out of 5 stars0 ratingsMastering Linux Shell Scripting,: A practical guide to Linux command-line, Bash scripting, and Shell programming Rating: 0 out of 5 stars0 ratingsMCA Modern Desktop Administrator Practice Tests: Exam MD-100 and MD-101 Rating: 0 out of 5 stars0 ratingsLinux for Beginners: Linux Command Line, Linux Programming and Linux Operating System Rating: 4 out of 5 stars4/5Mastering Embedded Linux Programming - Second Edition Rating: 4 out of 5 stars4/5Learning VMware vSphere Rating: 0 out of 5 stars0 ratingsLearn PowerShell Scripting in a Month of Lunches Rating: 0 out of 5 stars0 ratingsEvaluation of Some Android Emulators and Installation of Android OS on Virtualbox and VMware Rating: 0 out of 5 stars0 ratingsLearn SQL Server Administration in a Month of Lunches Rating: 3 out of 5 stars3/5Mastering NGINX - Second Edition Rating: 0 out of 5 stars0 ratings
Reviews for Docker High Performance
0 ratings0 reviews
Book preview
Docker High Performance - Espinosa Allan
Docker High Performance
Second Edition
Complete your Docker journey by optimizing your application's workflows and performance
Allan Espinosa
Russ McKendrick
BIRMINGHAM - MUMBAI
Docker High Performance Second Edition
Copyright © 2019 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author(s), nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Vijin Boricha
Acquisition Editor: Aditi Gour
Content Development Editor: Roshan Kumar
Technical Editor: Adya Anand
Copy Editor: Safis Editing
Project Coordinator: Namrata Swetta
Proofreader: Safis Editing
Indexer: Tejal Daruwale Soni
Graphics: Jisha Chirayil
Production Coordinator: Jisha Chirayil
First published: January 2016
Second edition: April 2019
Production reference: 1300419
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78980-721-9
www.packtpub.com
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
Packt.com
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at customercare@packtpub.com for more details.
At www.packt.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Contributors
About the authors
Allan Espinosa is a DevOps practitioner and an active open source contributor to various distributed system tools, such as Docker and Chef. Allan maintains several Docker images for popular open source software that were popular even before their official release from the upstream open source groups.
Throughout his career, Allan has worked on large distributed systems containing hundreds to thousands of servers in production. He has built scalable applications on various platforms, ranging from large supercomputing centers to production clusters in the enterprise. He is currently managing distributed systems at scale for Bloomberg, where he oversees the company's Hadoop infrastructure. Allan can be contacted through his Twitter handle, @AllanEspinosa.
I would like to thank my wife, Kana, for the continuous support that allowed me to spend significant time with this project.
Russ McKendrick is an experienced system administrator who has been working in IT and related industries for over 25 years. During his career, he has had varied responsibilities, from looking after an entire IT infrastructure to providing first-line, second-line, and senior support in both client-facing and internal teams for large organizations.
Russ supports open source systems and tools on public and private clouds at N4Stack, a Node4 company, where he is the practice manager (SRE and DevOps). In his spare time, he has written several books including Mastering Docker, Learn Ansible and Kubernetes for Serverless Applications, all published by Packt Publishing.
About the reviewer
Shashikant Bangera is a lead DevOps architect working for a multinational IT service provider. He specializes in architecting automated, efficient delivery pipelines to help build software rapidly and effectively. He has extensive experience with the cloud, containers, and DevOps tools and process. He has worked across a variety of domains, and designed DevOps processes and automation for large-scale projects. He is an open source enthusiast and has multiple projects under his name on GitHub. He has a master's degree from Welingkar University.
Packt is searching for authors like you
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Table of Contents
Title Page
Copyright and Credits
Docker High Performance Second Edition
About Packt
Why subscribe?
Packt.com
Contributors
About the authors
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Get in touch
Reviews
Preparing Docker Hosts
Preparing a Docker host
Enabling remote access
Setting up a certificate authority
Enabling remote access in Docker Engine
Connecting remotely from the Docker client
Building a Docker Swarm cluster
Summary
Configuring Docker with Chef
Importance of configuration management
Using Chef
Signing up for a Chef server
Setting up our workstation
Bootstrap nodes
Configuring the Docker host
Writing Chef recipes
Push Chef policies
Initializing Docker Swarm
Alternative methods
Summary
Monitoring Docker
The importance of monitoring
Collecting metrics with Prometheus
Exposing Prometheus's metrics
Scraping and visualizing metrics
Consolidating logs in an ELK stack
Deploying Elasticsearch, Logstash, and Kibana
Forwarding Docker container logs
Other monitoring and logging solutions
Summary
Optimizing Docker Images
Reducing deployment time
Improving image build time
Using registry mirrors
Reusing image layers
Reducing the build context size
Using caching proxies
Reducing Docker image size
Chaining commands
Separating build and deployment images
Guide to Optimization
Summary
Deploying Containers
Deploying and configuring Jenkins
Deploying the Jenkins container
Finishing the Jenkins Configuration
Setting up our Docker credentials within Jenkins
Building and deploying a container
Preparing our application
Creating a Jenkins job
Running the Pipeline
Summary
Benchmarking
Setting up Apache JMeter
Deploying a sample application
Installing JMeter
Building a benchmark workload
Creating a test plan in JMeter
Analyzing benchmark results
Viewing the results of JMeter runs
Calculating throughput
Plotting response time
Observing performance in Grafana and Kibana
Tuning the benchmark
Increasing concurrency
Running distributed tests
Other benchmarking tools
Summary
Load Balancing
Preparing application backends
Balancing load with NGINX
Scaling out our Docker applications
Deploying with zero downtime
Other load balancers
Summary
Troubleshooting Containers
Inspecting containers with the docker exec command
Debugging from outside Docker
Tracing system calls
Analyzing network packets
Observing block devices
Other container debugging tools
Summary
Onto Production
Performing web operations
Supporting web applications with Docker
Deploying applications
Scaling applications
Further reading
Summary
Other Books You May Enjoy
Leave a review - let other readers know what you think
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
A Linux workstation with a recent