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
Table of contents 1. Download 2. Deployment 3. Ng...
MySQL5.7.21 installation and password setting tut...
Nginx global variables There are many global vari...
watch : listen for data changes (change events of...
First, pull the image (or just create a container...
Problem Description I created three virtual machi...
Table of contents 1. Introduction 2. Switching 1....
This article introduces Nginx from compilation an...
Create Table create table table name create table...
This article shares the specific code of how to d...
About the tree display of Vue, the project is use...
Table of contents First we need to build the page...
Website, (100-1)% of the content is navigation 1....
Preface When developing a project, I encountered ...
The installation information on the Internet is u...