Home > Article > Operation and Maintenance > How to check how much memory docker takes up
How to check how much memory docker takes up:
1. Use the docker stats command to check:
$ docker stats CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS b95a83497c91 awesome_brattain 0.28% 5.629MiB / 1.952GiB 0.28% 916B / 0B 147kB / 0B 9 67b2525d8ad1 foobar 0.00% 1.727MiB / 1.952GiB 0.09% 2.48kB / 0B 4.11MB / 0B 2 e5c383697914 test-1951.1.kay7x1lh1twk9c0oig50sd5tr 0.00% 196KiB / 1.952GiB 0.01% 71.2kB / 0B 770kB / 0B 1 4bda148efbc0 random.1.vnc8on831idyr42slu578u3cr 0.00% 1.672MiB / 1.952GiB 0.08% 110kB / 0B 578kB / 0B 2
2. First find the container ID of the container through docker ps -a, and then use ps -ef to find the process corresponding to the container. After obtaining the pid corresponding to the container, you can use top, pmap, ps and other commands to view the process memory to view the memory of the container. Occupancy situation.
top
top -p 5140
Content explanation
PID: ID of the process
USER: Process owner
PR: Priority level of the process , the smaller it is, the priority it will be executed
NInice: Value
VIRT: The virtual memory occupied by the process
RES: The physical memory occupied by the process
SHR: Shared memory used by the process
S: The status of the process. S means sleeping, R means running, Z means zombie state, N means the priority value of the process is a negative number
%CPU: The usage rate of the CPU occupied by the process
%MEM: The physics used by the process Percentage of memory and total memory
TIME: The total CPU time occupied by the process after it is started, that is, the accumulated value of the CPU usage time.
COMMAND: Process startup command name
For more related tutorials, please pay attention to the docker tutorial column on the PHP Chinese website.
The above is the detailed content of How to check how much memory docker takes up. For more information, please follow other related articles on the PHP Chinese website!