Enable Debug On Docker Desktop With WSL 2

Debugging Docker containers can help troubleshoot and detect application and performance issues, and Docker makes the process of enabling and disabling debugging easy to configure.

By default debugging is disabled and should be disabled if there is no active need to troubleshoot.

Enable Debug

Open the daemon.json file; the file is located in the following path on Windows 10 and Windows 11. Copy the line below to Windows explorer, and you will see the file.

%userprofile%\.docker

In the demon.json file, set the debug key-value pair to true as shown below, I also added the log-level option with the level set to debug. You can also set the level to (debug, info, warn, error and fatal).

{
  "registry-mirrors": [],
  "insecure-registries": [],
  "debug": true,
  "log-level":"debug"
  "experimental": false,
  "features": {
    "buildkit": true
  },
  "builder": {
    "gc": {
      "enabled": true,
      "defaultKeepStorage": "20GB"
    }
  }
}

After saving the file, restart Docker Desktop.


Posted

in

by