1.问题描述
docker突然宕机了
2.问题排查
查看日志,发现OOM,进程被杀掉了。
查看日志的命令:
grep “Out of memory” /var/log/*
root@instance-9yth8w98-1:/var/log# grep "Out of memory" /var/log/*
grep: /var/log/apt: Is a directory
grep: /var/log/dist-upgrade: Is a directory
grep: /var/log/fsck: Is a directory
/var/log/kern.log:Jun 23 08:41:19 instance-9yth8w98-1 kernel: [20035645.202681] Out of memory: Kill process 15387 (java) score 197 or sacrifice child
grep: /var/log/lxd: Is a directory
grep: /var/log/mysql: Is a directory
grep: /var/log/nginx: Is a directory
grep: /var/log/ntpstats: Is a directory
/var/log/syslog:Jun 23 08:41:19 instance-9yth8w98-1 kernel: [20035645.202681] Out of memory: Kill process 15387 (java) score 197 or sacrifice child
grep: /var/log/unattended-upgrades: Is a directory
3.解决问题
释放内存并将docker容器设置成自启动,
自启动命令:
docker update --restart=always course2_admin
4.文章参考链接
a. https://www.v2ex.com/t/525772
b. https://www.cnblogs.com/sunshine2016/p/8549955.html
c. https://blog.csdn.net/hecr_mingong/article/details/106901633