Docker view process, memory, cup consumptionStart the docker container and view the process number through docker inspect # docker inspect -f '{{.State.Pid}}' View memory and CPU usage through docker statsdocker stats docker stats --no-stream docker stats container-name docker stats $(docker ps --format={{.Names}}) docker stats --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}" docker stats --no-stream --format "{\"container\":\"{{ .Container }}\",\"memory\":{\"raw\":\"{{ .MemUsage }}\",\"percent\":\"{{ .MemPerc }}\"},\"cpu\":\"{{ .CPUPerc }}\"}" Here are all the placeholders you can use in your custom formats:.Container Displays the name or ID of the container, depending on the name specified by the user. .Name The container name. .ID Container ID. .CPUPerc CPU usage. .MemUsage Memory usage. .NetIO Network I/O. .BlockIO disk I/O. .MemPerc Memory usage. .PIDs PID number. Supplement: Docker view container running memory and delete commands 1. Docker usage of cpu, memory, network, and io1.1、docker stats container id node3:~# docker stats 7a20f9671dbd CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS 7a20f9671dbd 0.09% 1.837GiB / 3.859GiB 47.61% 52.3MB / 28.7MB 3.32MB / 16.4kB 62 1.2, -a displays all containers (default displays just run) node3:~# docker stats -a CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS 7a20f9671dbd 0.09% 1.837GiB / 3.859GiB 47.61% 52.4MB / 28.7MB 3.32MB / 16.4kB 62 4eeb00be3547 0.69% 34.3MiB / 3.859GiB 0.87% 0B / 0B 5.8MB / 0B 19 c52a162de8e8 0.23% 131MiB / 3.859GiB 3.32% 1.01GB / 860MB 3.25MB / 106kB 22 ff7ed47106ad 0.00% 11.98MiB / 3.859GiB 0.30% 0B / 0B 1.9MB / 11.3MB 9 33b6ad13d1dc 0.13% 3.48MiB / 3.859GiB 0.09% 800B / 0B 0B / 0B 8 06a1d01f5024 0.19% 6.973MiB / 3.859GiB 0.18% 0B / 0B 143kB / 5.37MB 23 5e03f86078fd 0.00% 15.06MiB / 3.859GiB 0.38% 0B / 0B 1.79MB / 4.1kB 13 c78ed69d6c66 0.01% 6.227MiB / 3.859GiB 0.16% 0B / 0B 0B / 0B 7 1.3. Display the running information of multiple containers docker stats rId1,rId2 2. Docker delete command2.1. Delete all stopped containers docker rm $(docker ps -a -q) 2.2. Delete all untagged images docker rmi $(docker images -q | awk '/^<none>/ { print $3 }') 2.3. Fuzzy deletion docker images | grep registry.cn-qingdao.aliyuncs.com/duodianyouhui/dev-server | xargs docker rmi The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. If there are any mistakes or incomplete considerations, please feel free to correct me. You may also be interested in:
|
<<: Analysis of several situations where MySQL index fails
>>: Vue+video.js implements video playlist
In order to avoid repeatedly entering the Docker ...
Table of contents Preface first step: Step 2: Mod...
Today's Tasks 1. Choice of Linux distribution...
Table of contents What is a trigger Create a trig...
Table of contents 1. MySQL time type 2. Check the...
Table of contents Methods that do not change the ...
When to install If you use the protoc command and...
Basic Concepts By default, Compose creates a netw...
Environmental Description: There is a running MyS...
Typical layout examples As shown in the above pic...
1. Make a repo file Refer to the official install...
When using Docker in a production environment, da...
There are two meta attributes: name and http-equiv...
MySQL query not using index aggregation As we all...
This article shares the specific code of Vue usin...