mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add dockerinit SHA1 and path to "docker info" when debug mode is enabled
This commit is contained in:
parent
2035af44aa
commit
f02d766f9a
2 changed files with 16 additions and 0 deletions
|
@ -469,6 +469,13 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
|
|||
fmt.Fprintf(cli.out, "LXC Version: %s\n", remoteInfo.Get("LXCVersion"))
|
||||
fmt.Fprintf(cli.out, "EventsListeners: %d\n", remoteInfo.GetInt("NEventsListener"))
|
||||
fmt.Fprintf(cli.out, "Kernel Version: %s\n", remoteInfo.Get("KernelVersion"))
|
||||
|
||||
if initSha1 := remoteInfo.Get("InitSha1"); initSha1 != "" {
|
||||
fmt.Fprintf(cli.out, "Init SHA1: %s\n", initSha1)
|
||||
}
|
||||
if initPath := remoteInfo.Get("InitPath"); initPath != "" {
|
||||
fmt.Fprintf(cli.out, "Init Path: %s\n", initPath)
|
||||
}
|
||||
}
|
||||
|
||||
if len(remoteInfo.GetList("IndexServerAddress")) != 0 {
|
||||
|
|
|
@ -634,6 +634,13 @@ func (srv *Server) DockerInfo(job *engine.Job) engine.Status {
|
|||
kernelVersion = kv.String()
|
||||
}
|
||||
|
||||
// if we still have the original dockerinit binary from before we copied it locally, let's return the path to that, since that's more intuitive (the copied path is trivial to derive by hand given VERSION)
|
||||
initPath := utils.DockerInitPath("")
|
||||
if initPath == "" {
|
||||
// if that fails, we'll just return the path from the runtime
|
||||
initPath = srv.runtime.sysInitPath
|
||||
}
|
||||
|
||||
v := &engine.Env{}
|
||||
v.SetInt("Containers", len(srv.runtime.List()))
|
||||
v.SetInt("Images", imgcount)
|
||||
|
@ -649,6 +656,8 @@ func (srv *Server) DockerInfo(job *engine.Job) engine.Status {
|
|||
v.SetInt("NEventsListener", len(srv.events))
|
||||
v.Set("KernelVersion", kernelVersion)
|
||||
v.Set("IndexServerAddress", auth.IndexServerAddress())
|
||||
v.Set("InitSha1", utils.INITSHA1)
|
||||
v.Set("InitPath", initPath)
|
||||
if _, err := v.WriteTo(job.Stdout); err != nil {
|
||||
job.Error(err)
|
||||
return engine.StatusErr
|
||||
|
|
Loading…
Add table
Reference in a new issue