docker如何查看報錯?
docker查看報錯的方法:
一、登錄docker宿主機分析問題
1、啟動iframe-test機器
root@ubuntu:~#docker?start?iframe-test iframe-test
2、發現沒有容器進程
root@ubuntu:~#docker?ps?|grep?iframe-test
3、查看日志,發現是nginx配置有問題,導致中斷。
root@ubuntu:~#?docker?logs?iframe-test Startingnginx:?Starting?periodic?command?scheduler:?cron. nginx:[emerg]?unexpected?end?of?file,?expecting?";"?or?"}"?in/etc/nginx/nginx.conf:21 nginx:configuration?file?/etc/nginx/nginx.conf?test?failed
二、docker容器啟動的故障提示
[root@server?opt]#?docker?run?-it?--rm?--name?aa?centos:latest /usr/bin/docker-current:?Error?response?from?daemon:?shim?error:?docker-runc?not?installed?on?system.
解決方法
[root@server?opt]#?cd?/usr/libexec/docker/ [root@server?docker]#?sudo?ln?-s?docker-runc-current?docker-runc
三、docker容器內存不夠
Docker 啟動至少需要2G內存,首先執行free -mh命令查看剩余內存是否足夠
直接查看內存
$free?-mh total?used?free?shared?buff/cache?available Mem:?15G?14G?627M?195M?636M?726M Swap:?0B?0B?0B
分析日志
有時候一瞬間內存過載溢出,導致部分進程被殺死,看起來內存也是夠用的,事實上docker還是會反復重啟,就需要通過docker日志和系統日志信的息來進一步分析。
推薦教程:《docker視頻教程》
? 版權聲明
文章版權歸作者所有,未經允許請勿轉載。
THE END