Monitoring containers
There are some ways of monitoring running Docker containers. It can be viewing the log files, looking at the container events and statistics, and also inspecting container properties. Let's begin with the powerful logging features Docker has. Access to the log entries is crucial, especially if you have your container running in the detached runtime mode. Let's see what Docker can offer when it comes to a logging mechanism.
Viewing logs
Most applications output their log entries to the standard stdout
stream. If the container is being run in the foreground mode, you will just see it in the console. However, when running a container in detached mode, you will see nothing but the container ID on the console. However, the Docker engine collects all the stdout
output from a running container in a history file on the host. You can display it by using the docker logs
command. The syntax of the command is as follows:
$ docker logs -f <container name or ID>
The docker logs...