mirror of https://github.com/docker/docs.git
98 lines
3.9 KiB
Markdown
98 lines
3.9 KiB
Markdown
---
|
|
title: Troubleshoot the Docker daemon
|
|
description: Configuring and troubleshooting the Docker daemon
|
|
keywords: docker, daemon, configuration, troubleshooting
|
|
---
|
|
|
|
This page describes how to troubleshoot and debug the daemon if you run into
|
|
issues.
|
|
|
|
You can turn on debugging on the daemon to learn about the runtime activity of
|
|
the daemon and to aid in troubleshooting. If the daemon is unresponsive, you can
|
|
also [force a full stack trace](logs.md#force-a-stack-trace-to-be-logged) of all
|
|
threads to be added to the daemon log by sending the `SIGUSR` signal to the
|
|
Docker daemon.
|
|
|
|
## Troubleshoot conflicts between the `daemon.json` and startup scripts
|
|
|
|
If you use a `daemon.json` file and also pass options to the `dockerd` command
|
|
manually or using start-up scripts, and these options conflict, Docker fails to
|
|
start with an error such as:
|
|
|
|
```none
|
|
unable to configure the Docker daemon with file /etc/docker/daemon.json:
|
|
the following directives are specified both as a flag and in the configuration
|
|
file: hosts: (from flag: [unix:///var/run/docker.sock], from file: [tcp://127.0.0.1:2376])
|
|
```
|
|
|
|
If you see an error similar to this one and you are starting the daemon manually
|
|
with flags, you may need to adjust your flags or the `daemon.json` to remove the
|
|
conflict.
|
|
|
|
> **Note**: If you see this specific error, continue to the
|
|
> [next section](#use-the-hosts-key-in-daemonjson-with-systemd) for a
|
|
> workaround.
|
|
|
|
If you are starting Docker using your operating system's init scripts, you may
|
|
need to override the defaults in these scripts in ways that are specific to the
|
|
operating system.
|
|
|
|
### Use the hosts key in daemon.json with systemd
|
|
|
|
One notable example of a configuration conflict that is difficult to
|
|
troubleshoot is when you want to specify a different daemon address from the
|
|
default. Docker listens on a socket by default. On Debian and Ubuntu systems
|
|
using `systemd`, this means that a host flag `-H` is always used when starting
|
|
`dockerd`. If you specify a `hosts` entry in the `daemon.json`, this causes a
|
|
configuration conflict (as in the above message) and Docker fails to start.
|
|
|
|
To work around this problem, create a new file
|
|
`/etc/systemd/system/docker.service.d/docker.conf` with the following contents,
|
|
to remove the `-H` argument that is used when starting the daemon by default.
|
|
|
|
```none
|
|
[Service]
|
|
ExecStart=
|
|
ExecStart=/usr/bin/dockerd
|
|
```
|
|
|
|
There are other times when you might need to configure `systemd` with Docker,
|
|
such as [configuring a HTTP or HTTPS proxy](systemd.md#httphttps-proxy).
|
|
|
|
> **Note**: If you override this option and then do not specify a `hosts` entry
|
|
> in the `daemon.json` or a `-H` flag when starting Docker manually, Docker
|
|
> fails to start.
|
|
|
|
Run `sudo systemctl daemon-reload` before attempting to start Docker. If Docker
|
|
starts successfully, it is now listening on the IP address specified in the
|
|
`hosts` key of the `daemon.json` instead of a socket.
|
|
|
|
<!-- prettier-ignore -->
|
|
> **Important**
|
|
>
|
|
> Setting `hosts` in the `daemon.json` is not supported on Docker
|
|
> Desktop for Windows or Docker Desktop for Mac.
|
|
{:.important}
|
|
|
|
## Out of memory issues
|
|
|
|
If your containers attempt to use more memory than the system has available, you
|
|
may experience an Out of Memory (OOM) exception, and a container, or the Docker
|
|
daemon, might be stopped 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](../containers/resource_constraints.md#understand-the-risks-of-running-out-of-memory).
|
|
|
|
## 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` or
|
|
`sudo service docker status`, or checking the service status using Windows
|
|
utilities.
|
|
|
|
Finally, you can check in the process list for the `dockerd` process, using
|
|
commands like `ps` or `top`.
|