Browse code

Add Sockets (-H) list to `docker -D info`.

This will allow us to _know_ what the user's -H settings are, which may
be useful for debugging later.

Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@fosiki.com> (github: SvenDowideit)

Sven Dowideit authored on 2014/04/26 19:22:05
Showing 8 changed files
... ...
@@ -9,7 +9,7 @@ feels wrong or incomplete.
9 9
 When reporting [issues](https://github.com/dotcloud/docker/issues) 
10 10
 on GitHub please include your host OS (Ubuntu 12.04, Fedora 19, etc),
11 11
 the output of `uname -a` and the output of `docker version` along with
12
-the output of `docker info`. Please include the steps required to reproduce
12
+the output of `docker -D info`. Please include the steps required to reproduce
13 13
 the problem if possible and applicable.
14 14
 This information will help us review and fix your issue faster.
15 15
 
... ...
@@ -452,6 +452,9 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
452 452
 		if initPath := remoteInfo.Get("InitPath"); initPath != "" {
453 453
 			fmt.Fprintf(cli.out, "Init Path: %s\n", initPath)
454 454
 		}
455
+		if len(remoteInfo.GetList("Sockets")) != 0 {
456
+			fmt.Fprintf(cli.out, "Sockets: %v\n", remoteInfo.GetList("Sockets"))
457
+		}
455 458
 	}
456 459
 
457 460
 	if len(remoteInfo.GetList("IndexServerAddress")) != 0 {
... ...
@@ -96,6 +96,7 @@ type Daemon struct {
96 96
 	containerGraph *graphdb.Database
97 97
 	driver         graphdriver.Driver
98 98
 	execDriver     execdriver.Driver
99
+	Sockets        []string
99 100
 }
100 101
 
101 102
 // Install installs daemon capabilities to eng.
... ...
@@ -878,6 +879,7 @@ func NewDaemonFromDirectory(config *daemonconfig.Config, eng *engine.Engine) (*D
878 878
 		sysInitPath:    sysInitPath,
879 879
 		execDriver:     ed,
880 880
 		eng:            eng,
881
+		Sockets:        config.Sockets,
881 882
 	}
882 883
 
883 884
 	if err := daemon.checkLocaldns(); err != nil {
... ...
@@ -31,6 +31,7 @@ type Config struct {
31 31
 	DisableNetwork              bool
32 32
 	EnableSelinuxSupport        bool
33 33
 	Context                     map[string][]string
34
+	Sockets                     []string
34 35
 }
35 36
 
36 37
 // ConfigFromJob creates and returns a new DaemonConfig object
... ...
@@ -66,6 +67,9 @@ func ConfigFromJob(job *engine.Job) *Config {
66 66
 		config.Mtu = GetDefaultNetworkMtu()
67 67
 	}
68 68
 	config.DisableNetwork = config.BridgeIface == DisableNetworkBridge
69
+	if sockets := job.GetenvList("Sockets"); sockets != nil {
70
+		config.Sockets = sockets
71
+	}
69 72
 
70 73
 	return config
71 74
 }
... ...
@@ -162,6 +162,7 @@ func main() {
162 162
 			job.Setenv("ExecDriver", *flExecDriver)
163 163
 			job.SetenvInt("Mtu", *flMtu)
164 164
 			job.SetenvBool("EnableSelinuxSupport", *flSelinuxEnabled)
165
+			job.SetenvList("Sockets", flHosts.GetAll())
165 166
 			if err := job.Run(); err != nil {
166 167
 				log.Fatal(err)
167 168
 			}
... ...
@@ -1099,9 +1099,16 @@ Display system-wide information
1099 1099
         {
1100 1100
              "Containers":11,
1101 1101
              "Images":16,
1102
+             "Driver":"btrfs",
1103
+             "ExecutionDriver":"native-0.1",
1104
+             "KernelVersion":"3.12.0-1-amd64"
1102 1105
              "Debug":false,
1103 1106
              "NFd": 11,
1104 1107
              "NGoroutines":21,
1108
+             "NEventsListener":0,
1109
+             "InitPath":"/usr/bin/docker",
1110
+             "Sockets":["unix:///var/run/docker.sock"],
1111
+             "IndexServerAddress":["https://index.docker.io/v1/"],
1105 1112
              "MemoryLimit":true,
1106 1113
              "SwapLimit":false,
1107 1114
              "IPv4Forwarding":true
... ...
@@ -563,25 +563,30 @@ tar, then the ownerships might not get preserved.
563 563
 
564 564
 ## info
565 565
 
566
-    Usage: docker info
567 566
 
568
-    Display system-wide information
567
+    Usage: docker info
569 568
 
570 569
 For example:
571 570
 
572
-    $ sudo docker info
573
-    Containers: 292
574
-    Images: 194
571
+    $ sudo docker -D info
572
+    Containers: 16
573
+    Images: 2138
574
+    Storage Driver: btrfs
575
+    Execution Driver: native-0.1
576
+    Kernel Version: 3.12.0-1-amd64
575 577
     Debug mode (server): false
576
-    Debug mode (client): false
577
-    Fds: 22
578
-    Goroutines: 67
579
-    LXC Version: 0.9.0
580
-    EventsListeners: 115
581
-    Kernel Version: 3.8.0-33-generic
582
-    WARNING: No swap limit support
583
-
584
-When sending issue reports, please use `docker version` and `docker info` to
578
+    Debug mode (client): true
579
+    Fds: 16
580
+    Goroutines: 104
581
+    EventsListeners: 0
582
+    Init Path: /usr/bin/docker
583
+    Sockets: [unix:///var/run/docker.sock tcp://0.0.0.0:4243]
584
+    Username: svendowideit
585
+    Registry: [https://index.docker.io/v1/]
586
+
587
+The global `-D` option tells all `docker` comands to output debug information.
588
+
589
+When sending issue reports, please use `docker version` and `docker -D info` to
585 590
 ensure we know how your setup is configured.
586 591
 
587 592
 ## inspect
... ...
@@ -780,6 +780,7 @@ func (srv *Server) DockerInfo(job *engine.Job) engine.Status {
780 780
 	v.Set("IndexServerAddress", registry.IndexServerAddress())
781 781
 	v.Set("InitSha1", dockerversion.INITSHA1)
782 782
 	v.Set("InitPath", initPath)
783
+	v.SetList("Sockets", srv.daemon.Sockets)
783 784
 	if _, err := v.WriteTo(job.Stdout); err != nil {
784 785
 		return job.Error(err)
785 786
 	}