1. Check Current Debug Status
Start by viewing your Docker daemon’s current settings:Debug Mode line in the output:
2. Create a Test Container & Inspect Default Logs
Launch a simple HTTPD container:/var/log/messages or journalctl -u docker.service). You should only see high-level entries about container creation:
3. Enable Docker Debug Mode
To capture detailed debug output, edit the Docker daemon configuration:-
Open
/etc/docker/daemon.json(create it if missing) and add:
If the file doesn’t exist, you can create it. Make sure the JSON remains valid—use a JSON linter if needed.
- Reload the Docker daemon:
4. Confirm Debug Mode Is Active
Run the inspect command again:Debug Mode: true along with extra metrics:
5. Generate and View Verbose Logs
Create a new container calledtest_debug:
6. Reload Docker with SIGHUP & Disable Debug
If you prefer a manual reload instead ofsystemctl:
-
Update
/etc/docker/daemon.jsonto disable debug mode: -
Identify the Docker daemon PID and send
SIGHUP:
Always verify you have the correct PID before sending signals. Killing the wrong process can disrupt your system.
- Check that debug is now off:
Command Reference
| Action | Command | |
|---|---|---|
| Check debug status | docker system info | |
| Launch a container | docker run -d --name <name> httpd:latest | |
| View system logs | tail -n 20 /var/log/messages | |
| Enable debug in daemon.json | Add "debug": true to /etc/docker/daemon.json | |
| Reload Docker via systemd | sudo systemctl reload docker | |
| Reload Docker via SIGHUP | sudo kill -SIGHUP $(pgrep dockerd) | |
| Disable debug in daemon.json | Change "debug": false in /etc/docker/daemon.json | |
| Verify debug flag only | `docker system info | grep “Debug Mode”` |