# Enable Debug Logging for Docker Daemon

## Problem

There is a need to enable or disable debug logging for the Docker daemon.

## Environment

* Platform9 Managed Kubernetes - All Versions
* Docker

## Answer

1. Edit the */etc/docker/daemon.json* file and set the ***"debug": true*** flag. The file should look as shown below when edited.

{% tabs %}
{% tab title="None" %}

```none
{
"bridge": "none",
"graph": "/var/lib/docker",
"group": "pf9group",
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "10"
},
"storage-driver": "",
"storage-opts": [ ],
"debug": true
}
```

{% endtab %}
{% endtabs %}

2. Send a SIGHUP signal to the Docker daemon, triggering it to reload its configuration without restarting the process.

{% tabs %}
{% tab title="None" %}

```none
# ps -ef | grep docker
root 17910 1 1 XX:XX ? XX:XX:XX /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="None" %}

```none
# kill -SIGHUP 17910
```

{% endtab %}
{% endtabs %}

3. To check whether the configuration has been applied, use the below command.

{% tabs %}
{% tab title="None" %}

```none
# docker info

Server:
Debug Mode: true
```

{% endtab %}
{% endtabs %}

Also, if the debug parameter is enabled, the output logs will be shown as follows.

{% tabs %}
{% tab title="None" %}

```none
# journalctl -u docker
master2 dockerd[17910]: time="XXXX-XX-XXTXX:XX:XX7819166Z" level=debug msg="Calling GET /v1.38/containers/json?filters=%7B%22label%22%3A%7B%22io.kubernetes.docker.type%3Dpodsandbox%22%3Atrue%7D%7D&limit=0"

master2 dockerd[17910]: time="XXXX-XX-XXTXX:XX:XX7819166Z" level=debug msg="Calling GET /v1.38/containers/json?all=1&filters=%7B%22label%22%3A%7B%22io.kubernetes.docker.type%3Dcontainer%22%3Atrue%7D%2C%22status%22%3A%7B%22running%22%3Atrue%7D%7D&limit=0"
```

{% endtab %}
{% endtabs %}

**Note:** To disable debug logging, perform both the steps again, setting ***"debug": false***.

## Additional Information

[Debug Logging for Docker](https://docs.docker.com/config/daemon/#enable-debugging)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://platform9.com/kb/pmk/how-to/enable-debug-logging-for-docker-daemon.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
