-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Description
Debugging the daemon can be quite gruesome work.
Even one of the simplest things like collecting a goroutine stack dump (most common request) is difficult to explain and even more difficult to collect.
We already have some API endpoints to aid in debugging but it's only available if debug mode is actually enabled.... forcing a daemon reload (also difficult to explain and perform) to enable it can even mess up the results.
I propose:
- Enable debug endpoints (namely
/debug/pprof/*) by default. - Add a new CLI subcommand
docker debugwhich includes a suite of subcommands for pulling the desired information
i.docker debug stack-> generates a goroutine stack dump
ii.docker debug profile <blah>-> generates pprof formatted reports (whatever happens to be supported by the language runtime)
ii.docker debug profile ls-> List available profiles (this requires a call to the daemon, otherwise would include in--helpoutput)
These commands either send output directly to stdout or optionally to an output file.
Potentially also interesting is grabbing a trace or a cpu profile (explicitly not supported above), perhaps by adding a --trace or --cpu-profile to a docker command.... but this may be left as another exercise.
note: not tied to the layout/naming of those commands
Anything under /debug or docker debug should be considered non-formal API that is subject to change outside the scope of API versioning.
In the future these endpoints can be used to generate something like a support tarball via docker debug support.