Skip to content

[RFC] docker debug sub-command #31924

@cpuguy83

Description

@cpuguy83

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:

  1. Enable debug endpoints (namely /debug/pprof/*) by default.
  2. Add a new CLI subcommand docker debug which 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 --help output)

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/apiAPIarea/cliClientkind/featureFunctionality or other elements that the project doesn't currently have. Features are new and shiny

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions