mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-04 04:31:28 +00:00
Add dockerinit SHA1 and path to "docker info" when debug mode is enabled
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user