Docker High Performance - Second Edition

Book description

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 workflows 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 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.

Downloading the example code for this ebook: You can download the example code files for this ebook on GitHub at the following link: https://github.com/PacktPublishing/Docker-High-Performance-Second-Edition. If you require support please email: customercare@packt.com

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. Docker High Performance Second Edition
  3. About Packt
    1. Why subscribe?
    2. Packt.com
  4. Contributors
    1. About the authors
    2. About the reviewer
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  6. Preparing Docker Hosts
    1. Preparing a Docker host
    2. Enabling remote access
      1. Setting up a certificate authority
      2. Enabling remote access in Docker Engine
      3. Connecting remotely from the Docker client
    3. Building a Docker Swarm cluster
    4. Summary
  7. Configuring Docker with Chef
    1. Importance of configuration management
    2. Using Chef
      1. Signing up for a Chef server
      2. Setting up our workstation
      3. Bootstrap nodes
    3. Configuring the Docker host
      1. Writing Chef recipes
      2. Push Chef policies
    4. Initializing Docker Swarm
    5. Alternative methods
    6. Summary
  8. Monitoring Docker
    1. The importance of monitoring
    2. Collecting metrics with Prometheus
      1. Exposing Prometheus's metrics
      2. Scraping and visualizing metrics
    3. Consolidating logs in an ELK stack
      1. Deploying Elasticsearch, Logstash, and Kibana
      2. Forwarding Docker container logs
    4. Other monitoring and logging solutions
    5. Summary
  9. Optimizing Docker Images
    1. Reducing deployment time
    2. Improving image build time
      1. Using registry mirrors
      2. Reusing image layers
      3. Reducing the build context size
      4. Using caching proxies
    3. Reducing Docker image size
      1. Chaining commands
      2. Separating build and deployment images
    4. Guide to Optimization
    5. Summary
  10. Deploying Containers
    1. Deploying and configuring Jenkins
      1. Deploying the Jenkins container
      2. Finishing the Jenkins Configuration
      3. Setting up our Docker credentials within Jenkins
    2. Building and deploying a container
      1. Preparing our application
      2. Creating a Jenkins job
      3. Running the Pipeline
    3. Summary
  11. Benchmarking
    1. Setting up Apache JMeter
      1. Deploying a sample application
      2. Installing JMeter
    2. Building a benchmark workload
      1. Creating a test plan in JMeter
    3. Analyzing benchmark results
      1. Viewing the results of JMeter runs
        1. Calculating throughput
        2. Plotting response time
      2. Observing performance in Grafana and Kibana
    4. Tuning the benchmark
      1. Increasing concurrency
      2. Running distributed tests
    5. Other benchmarking tools
    6. Summary
  12. Load Balancing
    1. Preparing application backends
    2. Balancing load with NGINX
    3. Scaling out our Docker applications
      1. Deploying with zero downtime
    4. Other load balancers
    5. Summary
  13. Troubleshooting Containers
    1. Inspecting containers with the docker exec command
    2. Debugging from outside Docker
      1. Tracing system calls
      2. Analyzing network packets
      3. Observing block devices
    3. Other container debugging tools
    4. Summary
  14. Onto Production
    1. Performing web operations
    2. Supporting web applications with Docker
    3. Deploying applications
    4. Scaling applications
    5. Further reading
    6. Summary
  15. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Docker High Performance - Second Edition
  • Author(s): Allan Espinosa, Russ McKendrick
  • Release date: April 2019
  • Publisher(s): Packt Publishing
  • ISBN: 9781789807219