Monitoring Docker containers
In this recipe, we will learn to monitor Docker containers.
How to do it…
Docker provides inbuilt monitoring with the docker stats
command, which can be used to get a live stream of the resource utilization of Docker containers.
- To monitor multiple containers at once using their respective IDs or names, use this command:
$ docker stats mysql f9617f4b716c
Tip
If you need to monitor all running containers, use the following command:
$ docker stats $(dockerps -q)
- With
docker logs
, you can fetch logs of your application running inside a container. This can be used similarly to thetail -f
command:$ docker logs -f ubuntu
- Docker ...
Get Ubuntu Server Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.