Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to count the status of Docker container resources?

Shulou Source: shulou.com Published: 2022-06-02 08:43:13 10月02日 Update

Before we begin

How do I count the resource information occupied by a container?

Docker provides the stats subcommand to understand the resource usage of the current running container, including: CPU, memory, network IO, disk IO, and so on.

Environment description

Docker 1.10.3 on CentOS 7

This version of Docker is very old and can not be found at present. In addition, Ubuntu Server 16.04 LTS is recommended for Linux host operating system Docker, which can better support advanced features such as overlay2 storage driver.

For instance

1. All container status information is output by default

Docker stats# uses Ctrl + C to exit statistics

two。 Outputs the specified container status information

Docker stats nginx# uses Ctrl + C to exit statistics

3. Or you can output the result only once.

Docker stats-- no-stream nginx command helps docker stats-- helpUsage: docker stats [OPTIONS] [CONTAINER...] Display a live stream of container (s) resource usage statistics-a,-- all Show all containers (default shows just running)-- help Print usage-- no-stream Disable streaming stats and only pull the first result summary

Finally, let's summarize the knowledge points in the article.

Learn about the resource usage of the currently running container through the docker stats subcommand. Output real-time statistics by default and exit using Ctrl + C key. Parameter-no-stream means that real-time statistics are disabled and only the results obtained for the first time are used.

Reference article

Doker&k8s Qun [703906133]

Tags: Containers statistics resources information output commands situations status real-time articles results runs antiquity advanced operating systems examples memory parameters hosts hosts Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information MySQL MariaDB Shulou Technology Microsoft