Browse Source

Return docker's root dir in docker -D info

This adds the docker daemon's root directory to docker info when running
in debug mode.  This allows the user to view the root directory where
docker is writing and storing state.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Michael Crosby 10 years ago
parent
commit
654da4e151
3 changed files with 5 additions and 0 deletions
  1. 3 0
      api/client/commands.go
  2. 1 0
      daemon/info.go
  3. 1 0
      docs/sources/reference/commandline/cli.md

+ 3 - 0
api/client/commands.go

@@ -544,6 +544,9 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
 		if initPath := remoteInfo.Get("InitPath"); initPath != "" {
 		if initPath := remoteInfo.Get("InitPath"); initPath != "" {
 			fmt.Fprintf(cli.out, "Init Path: %s\n", initPath)
 			fmt.Fprintf(cli.out, "Init Path: %s\n", initPath)
 		}
 		}
+		if root := remoteInfo.Get("DockerRootDir"); root != "" {
+			fmt.Fprintf(cli.out, "Docker Root Dir: %s\n", root)
+		}
 	}
 	}
 
 
 	if len(remoteInfo.GetList("IndexServerAddress")) != 0 {
 	if len(remoteInfo.GetList("IndexServerAddress")) != 0 {

+ 1 - 0
daemon/info.go

@@ -76,6 +76,7 @@ func (daemon *Daemon) CmdInfo(job *engine.Job) engine.Status {
 	v.Set("InitPath", initPath)
 	v.Set("InitPath", initPath)
 	v.SetInt("NCPU", runtime.NumCPU())
 	v.SetInt("NCPU", runtime.NumCPU())
 	v.SetInt64("MemTotal", meminfo.MemTotal)
 	v.SetInt64("MemTotal", meminfo.MemTotal)
+	v.Set("DockerRootDir", daemon.Config().Root)
 	if hostname, err := os.Hostname(); err == nil {
 	if hostname, err := os.Hostname(); err == nil {
 		v.Set("Name", hostname)
 		v.Set("Name", hostname)
 	}
 	}

+ 1 - 0
docs/sources/reference/commandline/cli.md

@@ -934,6 +934,7 @@ For example:
     Goroutines: 9
     Goroutines: 9
     EventsListeners: 0
     EventsListeners: 0
     Init Path: /usr/bin/docker
     Init Path: /usr/bin/docker
+    Docker Root Dir: /var/lib/docker
     Username: svendowideit
     Username: svendowideit
     Registry: [https://index.docker.io/v1/]
     Registry: [https://index.docker.io/v1/]
     Labels:
     Labels: