Browse code

Merge pull request #2967 from crosbymichael/return-host-config

Add hostconfig to container inspect

Guillaume J. Charmes authored on 2013/12/05 09:50:42
Showing 4 changed files
... ...
@@ -875,7 +875,10 @@ func getContainersByName(srv *Server, version float64, w http.ResponseWriter, r
875 875
 		return fmt.Errorf("Conflict between containers and images")
876 876
 	}
877 877
 
878
-	return writeJSON(w, http.StatusOK, container)
878
+	container.readHostConfig()
879
+	c := APIContainer{container, container.hostConfig}
880
+
881
+	return writeJSON(w, http.StatusOK, c)
879 882
 }
880 883
 
881 884
 func getImagesByName(srv *Server, version float64, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
... ...
@@ -118,6 +118,10 @@ type (
118 118
 		Resource string
119 119
 		HostPath string
120 120
 	}
121
+	APIContainer struct {
122
+		*Container
123
+		HostConfig *HostConfig
124
+	}
121 125
 )
122 126
 
123 127
 func (api APIImages) ToLegacy() []APIImagesOld {
... ...
@@ -51,6 +51,10 @@ What's new
51 51
    **New!** This endpoint now returns build status as json stream. In case
52 52
    of a build error, it returns the exit status of the failed command.
53 53
 
54
+.. http:get:: /containers/(id)/json
55
+
56
+    **New!** This endpoint now returns the host config for the container.
57
+
54 58
 
55 59
 v1.7
56 60
 ****
... ...
@@ -222,7 +222,23 @@ Inspect a container
222 222
 			},
223 223
 			"SysInitPath": "/home/kitty/go/src/github.com/dotcloud/docker/bin/docker",
224 224
 			"ResolvConfPath": "/etc/resolv.conf",
225
-			"Volumes": {}
225
+			"Volumes": {},
226
+                        "HostConfig": {
227
+                            "Binds": null,
228
+                            "ContainerIDFile": "",
229
+                            "LxcConf": [],
230
+                            "Privileged": false,
231
+                            "PortBindings": {
232
+                               "80/tcp": [
233
+                                   {
234
+                                       "HostIp": "0.0.0.0",
235
+                                       "HostPort": "49153"
236
+                                   }
237
+                               ]
238
+                            },
239
+                            "Links": null,
240
+                            "PublishAllPorts": false
241
+                        }
226 242
 	   }
227 243
 
228 244
 	:statuscode 200: no error