设为首页 收藏本站
查看: 638|回复: 0

[经验分享] Docker Where are the Docker daemon logs?

[复制链接]

尚未签到

发表于 2018-5-27 07:53:32 | 显示全部楼层 |阅读模式
Troubleshoot the daemon
You can enable debugging on the daemon to learn about the runtime activity of the daemon and to aid in troubleshooting. If the daemon is completely non-responsive, you can also force a full stack trace of all threads to be added to the daemon log by sending the SIGUSR signal to the Docker daemon.
Out Of Memory Exceptions (OOME)
If your containers attempt to use more memory than the system has available, you may experience an Out Of Memory Exception (OOME) and a container, or the Docker daemon, might be killed by the kernel OOM killer. To prevent this from happening, ensure that your application runs on hosts with adequate memory and see Understand the risks of running out of memory.
Read the logs
The daemon logs may help you diagnose problems. The logs may be saved in one of a few locations, depending on the operating system configuration and the logging subsystem used:
Operating systemLocationRHEL, Oracle Linux/var/log/messagesDebian/var/log/daemon.logUbuntu 16.04+, CentOSUse the command journalctl -u docker.serviceUbuntu 14.10-/var/log/upstart/docker.logmacOS~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/console-ringWindowsAppData\LocalEnable debugging
There are two ways to enable debugging. The recommended approach is to set the debug key to true in the daemon.json file. This method works for every Docker platform.

  • Edit the daemon.json file, which is usually located in /etc/docker/. You may need to create this file, if it does not yet exist. On macOS or Windows, do not edit the file directly. Instead, go to Preferences / Daemon / Advanced.
  • If the file is empty, add the following:
    {
      "debug": true}If the file already contains JSON, just add the key "debug": true, being careful to add a comma to the end of the line if it is not the last line before the closing bracket. Also verify that if the log-level key is set, it is set to either info or debug. info is the default, and possible values are debug, info, warn, error, fatal.
  • Send a HUP signal to the daemon to cause it to reload its configuration. On Linux hosts, use the following command.
    $ sudo kill -SIGHUP $(pidof dockerd)On Windows hosts, restart Docker.
Instead of following this procedure, you can also stop the Docker daemon and restart it manually with the -D flag. However, this may result in Docker restarting with a different environment than the one the hosts’ startup scripts will create, and this may make debugging more difficult.
Force a stack trace to be logged
If the daemon is unresponsive, you can force a full stack trace to be logged by sending a SIGUSR1 signal to the daemon.

  • Linux:
    $ sudo kill -SIGUSR1 $(pidof dockerd)
  • Windows Server:
    Download docker-signal.
    Run the executable with the flag --pid=<PID of daemon>.
This will force a stack trace to be logged but will not stop the daemon. Daemon logs will show the stack trace or the path to a file containing the stack trace if it was logged to a file.
The daemon will continue operating after handling the SIGUSR1 signal and dumping the stack traces to the log. The stack traces can be used to determine the state of all goroutines and threads within the daemon.
View stack traces
The Docker daemon log can be viewed by using one of the following methods:

  •   By running journalctl -u docker.service on Linux systems using systemctl
  •   /var/log/messages, /var/log/daemon.log, or /var/log/docker.log on older Linux systems
  •   By running Get-EventLog -LogName Application -Source Docker -After (Get-Date).AddMinutes(-5) | Sort-Object Time on Docker EE for Windows Server
Note: It is not possible to manually generate a stack trace on Docker for Mac or Docker for Windows. However, you can click the Docker taskbar icon and choose Diagnose and feedback to send information to Docker if you run into issues.
Look in the Docker logs for a message like the following:
...goroutine stacks written to /var/run/docker/goroutine-stacks-2017-06-02T193336z.log
...daemon datastructure dump written to /var/run/docker/daemon-data-2017-06-02T193336z.logThe locations where Docker saves these stack traces and dumps depends on your operating system and configuration. You may be able to get useful diagnostic information straight from the stack traces and dumps. Otherwise, you can provide this information to Docker for help diagnosing the problem.
Check whether Docker is running
The operating-system independent way to check whether Docker is running is to ask Docker, using the docker info command.
You can also use operating system utilities, such as sudo systemctl is-active docker or sudo status docker orsudo service docker status, or checking the service status using Windows utilities.
  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-481581-1-1.html 上篇帖子: centos 7 安装docker 并设置阿里云镜像仓库 下篇帖子: Centos7系统下Docker ce的安装及镜像加速
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表