Docker Where are the Docker daemon logs?

简介:

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 system Location
RHEL, Oracle Linux /var/log/messages
Debian /var/log/daemon.log
Ubuntu 16.04+, CentOS Use the command journalctl -u docker.service
Ubuntu 14.10- /var/log/upstart/docker.log
macOS ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/console-ring
Windows AppData\Local

Enable 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.

  1. 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.

  2. 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 debuginfo is the default, and possible values are debuginfowarnerrorfatal.

  3. 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.log

The 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.



本文转自 zbill 51CTO博客,原文链接:http://blog.51cto.com/dek701/1976426,如需转载请自行联系原作者
相关文章
|
8月前
|
Unix Docker 容器
Is the docker daemon running?
Is the docker daemon running?
|
1天前
|
安全 Linux 数据安全/隐私保护
docker运行报错docker: Error response from daemon: AppArmor enabled on system but the docker-default prof
docker运行报错docker: Error response from daemon: AppArmor enabled on system but the docker-default prof
82 0
|
11月前
|
网络虚拟化 Docker 容器
本地docker不能登录远程harbor服务器,error response from daemon,error parsing http 403 response body
本地docker不能登录远程harbor服务器,error response from daemon,error parsing http 403 response body
141 0
本地docker不能登录远程harbor服务器,error response from daemon,error parsing http 403 response body
|
6月前
|
Docker 容器
error during connect: this error may indicate that the docker daemon is not running
error during connect: this error may indicate that the docker daemon is not running
198 0
|
1天前
|
应用服务中间件 nginx Docker
Docker中报错 Error response from daemon: Conflict. The container name “/nginx01“ is already in use
在尝试运行 `docker run -d --name nginx01 -p 3344:80 nginx` 时遇到错误。问题源于已有名为 nginx01 的容器未正确终止,造成命名冲突。解决方法:首先使用 `docker ps -a` 查看所有容器,然后删除现有 nginx01 容器,执行 `docker rm &lt;container_id&gt;`(替换 `&lt;container_id&gt;` 为实际容器ID),最后再运行 `docker run` 命令即可。
|
1天前
|
Ubuntu Cloud Native Unix
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker 错误
在使用WSL(Ubuntu 18.04.6)时,初学者遇到运行Docker时的错误:“Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?”。解决问题的过程包括:首先尝试通过`sudo apt-get install daemon`安装daemon,然后使用`sudo service docker start`启动Docker。通过`sudo service docker status`确认Docker已启动,并成功运行`docker
|
6月前
|
Unix Docker 容器
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker
|
6月前
|
Docker Windows 容器
Docker在win10上报错,error during connect: In the default daemon configuration on Windows
Docker在win10上报错,error during connect: In the default daemon configuration on Windows
137 0
|
1天前
|
Docker 容器
百度搜索:蓝易云【docker启动报错:Cannot connect to the Docker daemon】
通过以上方法,你应该能够解决“Cannot connect to the Docker daemon”错误,并成功启动Docker。如果问题仍然存在,可能需要检查其他系统配置或查看Docker日志以找出具体原因。
44 2
|
1天前
|
Docker 容器
docker使用遇到问题Got permission denied while trying to connect to the Docker daemon socket
docker使用遇到问题Got permission denied while trying to connect to the Docker daemon socket
70 0