You are previewing Monitoring Docker.
O'Reilly logo
Monitoring Docker

Book Description

Monitor your Docker containers and their apps using various native and third-party tools with the help of this exclusive guide!

About This Book

  • Get the only book that covers multiple methods to monitoring Docker Containers -your one-stop solution to all your Docker monitoring needs

  • Learn how to implement third-party tools such as Datalog, cAdvisor, and more with this example-rich, hands-on guide

  • Learn how to efficiently monitor Docker containers and get an edge over other administrators while maintaining apps on these containers

  • Who This Book Is For

    This book is for DevOps engineers and system administrators who manage Docker containers and want to better manage these containers using expert techniques and methods and better maintain applications built on Docker.

    What You Will Learn

  • Discover the tools built into Docker to gain an insight into your containers’ performance

  • Augment Docker’s built-in tools with modern tools such as cAdvisor from Google, SysDig by Draios, and Soundcloud’s Prometheus

  • Integrate the monitoring of your containers with more traditional monitoring solutions such as Zabbix

  • Take advantage of the various SaaS offerings from third parties to move monitoring away from your local infrastructure and into the cloud

  • Discover the various ways to ship your applications’ logs from the container to a central logging service

  • Get the most out of your application and resources with the right implementation of your monitoring method

  • In Detail

    This book will show you how monitoring containers and keeping a keen eye on the working of applications helps improve the overall performance of the applications that run on Docker. With the increased adoption of Docker containers, the need to monitor which containers are running, what resources they are consuming, and how these factors affect the overall performance of the system has become the need of the moment.

    This book covers monitoring containers using Docker's native monitoring functions, various plugins, as well as third-party tools that help in monitoring. Well start with how to obtain detailed stats for active containers, resources consumed, and container behavior. We also show you how to use these stats to improve the overall performance of the system. Next, you will learn how to use SysDig to both view your containers performance metrics in real time and record sessions to query later. By the end of this book, you will have a complete knowledge of how to implement monitoring for your containerized applications and make the most of the metrics you are collecting

    Style and approach

    This is an easy-to-follow guide with plenty of hands-on examples that can be executed both on your local machine and externally hosted services.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the code file.

    Table of Contents

    1. Monitoring Docker
      1. Table of Contents
      2. Monitoring Docker
      3. Credits
      4. About the Author
      5. About the Reviewer
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      8. 1. Introduction to Docker Monitoring
        1. Pets, Cattle, Chickens, and Snowflakes
          1. Pets
          2. Cattle
          3. Chickens
          4. Snowflakes
          5. So what does this all mean?
        2. Docker
        3. Launching a local environment
        4. Cloning the environment
        5. Running a virtual server
        6. Halting the virtual server
        7. Summary
      9. 2. Using the Built-in Tools
        1. Docker stats
          1. Running Docker stats
        2. What just happened?
        3. What about processes?
          1. Docker top
          2. Docker exec
        4. Summary
      10. 3. Advanced Container Resource Analysis
        1. What is cAdvisor?
        2. Running cAdvisor using a container
        3. Compiling cAdvisor from source
        4. Collecting metrics
        5. The Web interface
          1. Overview
          2. Processes
          3. CPU
          4. Memory
          5. Network
          6. Filesystem
        6. Viewing container stats
          1. Subcontainers
          2. Driver status
          3. Images
        7. This is all great, what's the catch?
        8. Prometheus
          1. Launching Prometheus
          2. Querying Prometheus
          3. Dashboard
          4. The next steps
        9. Alternatives?
        10. Summary
      11. 4. A Traditional Approach to Monitoring Containers
        1. Zabbix
        2. Installing Zabbix
          1. Using containers
          2. Using vagrant
          3. Preparing our host machine
          4. The Zabbix web interface
        3. Docker metrics
          1. Create custom graphs
          2. Compare containers to your host machine
          3. Triggers
        4. Summary
      12. 5. Querying with Sysdig
        1. What is Sysdig?
        2. Installing Sysdig
        3. Using Sysdig
          1. The basics
          2. Capturing data
          3. Containers
          4. Further reading
        4. Using Csysdig
        5. Summary
      13. 6. Exploring Third Party Options
        1. A word about externally hosted services
          1. Deploying Docker in the cloud
        2. Why use a SaaS service?
        3. Sysdig Cloud
          1. Installing the agent
          2. Exploring your containers
          3. Summary and further reading
        4. Datadog
          1. Installing the agent
          2. Exploring the web interface
          3. Summary and further reading
        5. New Relic
          1. Installing the agent
          2. Exploring the web interface
          3. Summary and further reading
        6. Summary
      14. 7. Collecting Application Logs from within the Container
        1. Viewing container logs
        2. ELK Stack
          1. Starting the stack
          2. Logspout
          3. Reviewing the logs
          4. What about production?
        3. Looking at third party options
        4. Summary
      15. 8. What Are the Next Steps?
        1. Some scenarios
          1. Pets, Cattle, Chickens, and Snowflakes
            1. Pets
            2. Cattle
            3. Chickens
            4. Snowflakes
          2. Scenario one
          3. Scenario two
          4. Scenario three
        2. A little more about alerting
          1. Chickens
          2. Cattle and Pets
          3. Sending alerts
        3. Keeping up
        4. Summary
      16. Index