Book Image

Monitoring Docker

By : Russ McKendrick
Book Image

Monitoring Docker

By: Russ McKendrick

Overview of this book

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
Table of Contents (15 chapters)
Monitoring Docker
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Viewing container logs


Like the docker top command, there is a very basic way of viewing logs. When you use the docker logs command, you are actually viewing the STDOUT and STDERR of the processes that are running within the container.

Note

For more information on Standard Streams, please see https://en.wikipedia.org/wiki/Standard_streams.

As you can see from the following screenshot, the simplest thing you have to do is run docker logs followed by your container name:

To see this on your own host, let's launch the WordPress installation from chapter05 using the following commands:

cd /monitoring_docker/chapter05/wordpress/
docker-compose up –d
docker logs wordpress_wordpress1_1

You can extend the dockerlogs command by adding the following flags before your container name:

  • -f or --follow will stream the logs in real time

  • -t or --timestamps will show a timestamp at the start of each line

  • --tail="5" will show the last x number of lines

  • --since="5m00s" will show only the entries for the last 5...