Closed
Description
I run a Postgesql server in a docker container, when I run command "docker stats --no-stream", the memory usage of this container is 495.2MB as below:
c137012d8af9 0.00% 495.2 MB / 67.55 GB 0.73% 24.66 GB / 29.5 GB 0 B / 49.75 GB 0
But when I enter this container using command "docker exec -ti c137012d8af9 /bin/bash", then execute command "/usr/bin/top -bcn 1", the result is as below, the summation of the memory usage of all processes is about 381MB, the memory usage of "docker stats" is not equal with the summation of the memory usage of all processes in the docker container. Which one is correct?
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 10 -10 17976 2816 2580 S 0.0 0.0 0:00.02 /bin/bash /scripts/run.sh /bin/sh -c chmod 775 /usr/bin/jq
7 root 10 -10 47120 3072 2688 S 0.0 0.0 0:00.00 sudo -u postgres /usr/lib/postgresql/9.6/bin/postgres -D /data
8 postgres 10 -10 271644 33736 32456 S 0.0 0.1 0:05.76 /usr/lib/postgresql/9.6/bin/postgres -D /data
10 postgres 10 -10 271956 142604 141084 S 0.0 0.2 0:11.32 postgres: checkpointer process
11 postgres 10 -10 271644 138852 137544 S 0.0 0.2 0:52.12 postgres: writer process
12 postgres 10 -10 271644 8064 6760 S 0.0 0.0 0:16.37 postgres: wal writer process
13 postgres 10 -10 272368 17524 15944 S 0.0 0.0 0:01.25 postgres: autovacuum launcher process
14 postgres 10 -10 107476 3876 2364 S 0.0 0.0 1:08.22 postgres: stats collector process
10003 root 10 -10 18140 3276 2828 S 0.0 0.0 0:00.02 /bin/bash
10564 root 10 -10 18140 3272 2820 S 0.0 0.0 0:00.02 /bin/bash
10952 root 10 -10 18140 3248 2792 S 0.0 0.0 0:00.02 /bin/bash
11392 root 10 -10 18140 3284 2832 S 0.0 0.0 0:00.02 /bin/bash
11524 root 10 -10 18140 3136 2852 S 0.0 0.0 0:00.02 /bin/bash
11539 root 10 -10 19740 2316 2056 R 0.0 0.0 0:00.00 /usr/bin/top -bcn 1
The docker version is 1.11.0