Docker容器内存超限,Docker Daemon可以正常退出吗?


使用Docker时,发现有容器的内存超限了,然后宿主上的Docker Daemon直接就退出了,查看日志发现有Received signal 'terminated', starting shutdown of docker...这条日志,这是Docker的正常行为吗?
已邀请:

徐新坤 - 京东商城-TIG-JDOS团队

赞同来自:


容器OOM最多导致容器自身挂掉,而daemon应该是没有问题的。但是如果你分给容器的内存上限过大,导致整个物理机的内存不足了,则可能会发生这个问题。

shenghuofei

赞同来自:


容器内存限制比物理机内存小很多,dmesg看到有如下信息:<pre>
Task in /system.slice/docker-97d140758376d5585373ce83b56ad36ce87ee37ab652a61c312f4f77e7f9fbc7.scope killed as a result of limit of /system.slice/docker-97d140758376d5585373ce83b56ad36ce87ee37ab652a61c312f4f77e7f9fbc7.scope
memory: usage 8388608kB, limit 8388608kB, failcnt 286295
memory+swap: usage 8388608kB, limit 16777216kB, failcnt 0
kmem: usage 0kB, limit 9007199254740991kB, failcnt 0
Memory cgroup stats for /system.slice/docker-97d140758376d5585373ce83b56ad36ce87ee37ab652a61c312f4f77e7f9fbc7.scope: cache:412KB rss:8388196KB rss_huge:7092224KB mapped_file:0KB swap:0KB inactive_anon:0KB active_anon:8379932KB inactive_file:236KB active_file:8KB unevictable:0KB
uid tgid total_vm rss nr_ptes swapents oom_score_adj name
0 10907 3761 66 12 0 0 supervisord
0 10990 30175 2163 63 0 0 supervisord
0 11030 20697 209 43 0 -1000 sshd
0 11033 3760 53 13 0 0 bash
0 11935 162472 9284 172 0 0 salt-minion
1004 12001 741904 123040 385 0 0 java
1004 16350 3238 57 11 0 0 bash
1004 16359 1526520 219937 513 0 0 java
1004 16511 3238 57 10 0 0 bash
1004 16520 1526100 200124 503 0 0 java
1004 16597 3238 58 12 0 0 bash
1004 16607 1528380 199437 507 0 0 java
1004 20692 3238 57 12 0 0 bash
1004 20701 1527264 132966 370 0 0 java
1004 20914 3238 57 11 0 0 bash
1004 20924 1526443 126232 357 0 0 java
1004 21430 3238 56 12 0 0 bash
1004 21439 1526101 74493 254 0 0 java
1004 21680 3238 58 12 0 0 bash
1004 21689 985376 257846 604 0 0 java
1004 21790 3238 57 11 0 0 bash
1004 21800 983536 264808 629 0 0 java
1004 21872 3238 56 11 0 0 bash
1004 21882 982617 231000 559 0 0 java
1004 21921 3238 57 12 0 0 bash
1004 21930 984849 252554 597 0 0 java
Memory cgroup out of memory: Kill process 21842 (java) score 126 or sacrifice child
Killed process 21842 (java) total-vm:3934144kB, anon-rss:1058992kB, file-rss:240kB
br0: port 2(veth1pl10907) entered disabled state
device veth1pl10907 left promiscuous mode
br0: port 2(veth1pl10907) entered disabled state
device-mapper: thin: Creation of new snapshot 0 of device 4 failed.
device-mapper: thin: Creation of new snapshot 1 of device 4 failed.
device-mapper: thin: Creation of new snapshot 2 of device 4 failed.
device-mapper: thin: Creation of new snapshot 3 of device 4 failed.
device-mapper: thin: Creation of new snapshot 4 of device 4 failed.
device-mapper: thin: Creation of new snapshot 5 of device 4 failed.
EXT4-fs (dm-5): mounted filesystem with ordered data mode. Opts: discard
EXT4-fs (dm-6): mounted filesystem with ordered data mode. Opts: discard
EXT4-fs (dm-5): mounted filesystem with ordered data mode. Opts: discard
EXT4-fs (dm-5): mounted filesystem with ordered data mode. Opts: discard
device veth1pl22751 entered promiscuous mode</pre>
可以看到,容器内存限制是8G,但是物理内存100G+,肯定不会导致物理机OOM

sean - 齐家网技术总监

赞同来自:


是不是有什么程序(systemd)发送了kill信号?

要回复问题请先登录注册