When the scale of Docker deployment becomes larger, it is necessary to monitor the container. Generally, Docker comes with several monitoring subcommands such as ps, top, and stats. Then there is the popular open source monitoring tool Prometheus. Docker's own monitoring subcommand ps docker ps , lists containers, convenient for viewing currently running containers, the following is the command syntax and parameter syntax docker ps [OPTIONS] OPTIONS description:
Output details:
There are 7 states:
PORTS: The container's port information and the connection type used (tcp\udp). NAMES: Automatically assigned container names. The new version of Docker provides a new command docker container ls, which has the same function and usage as docker container ps. However, the meaning of ls may be more accurate than ps, so it is recommended. top If you want to know which processes are running in a container, you can execute the docker container top command as follows: The command can also be followed by parameters of the Linux operating system ps command to display specific information, such as -au. The execution result of docker container top [container name] -au is as follows: stats Docker container stats is used to display the usage of various resources for each container. By default, a real-time list is displayed, showing the CPU usage, memory, and available space of each container. If the memory limit is not specified when the container is started, the stats command will display the total amount of host memory, but this does not mean that each container can use so much memory. In addition, the docker container stats command will also display the container network and disk IO data. You can specify the name of the container after the stats command to display data for certain containers. Docker logs Docker's logging feature is configured by default. For a running container, Docker sends logs to the container's standard output device (STDOUT) and standard error device (STDERR). STDOUT and STDERR are actually the container's console terminal. If you want to view the container logs, there are two ways: Attach to this container. Use the docker logs command to view the logs. The ttach method is not very convenient in practice because: Only logs after attach can be seen, and logs before that are not visible. Exiting the attach state is more troublesome (Ctrl+p then Ctrl+q key combination), and it is easy to kill the container accidentally (for example, by pressing Ctrl+C). The recommended way to view container logs is to use the docker logs command. As shown below: docker logs can print the complete logs since the container was started, and the -f parameter can continue to print the newly generated logs, which is the same as tail -f in linux. The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Vue implements a small countdown function
>>: How to remotely log in to the MySql database?
Table of contents Vue routing relative path jump ...
Table of contents The order in which MySQL reads ...
This article shares the installation steps of MyS...
Preface Seeing the title, everyone should be thin...
MySQL 5.7.20 zip installation, the specific conte...
In a complex table structure, some cells span mul...
Table of contents 1. Basic usage and logic 2. Fea...
MySQL download and installation (version 8.0.20) ...
Download link: Operating Environment CentOS 7.6 i...
ref definition: used to register reference inform...
Problem code Look at a closure problem code cause...
The function I want to achieve is to open a new w...
Reminder: Whether it is planning, designing, or de...
background Solving browser compatibility issues i...
Table of contents Overview Code Implementation Pa...