From c4c90e9cec1b3f3cc5aa652e4e9155f6a2e687aa Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Fri, 29 Nov 2013 17:24:30 -0800 Subject: [PATCH 1/2] Add hostconfig to container inspect --- api.go | 5 ++++- api_params.go | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/api.go b/api.go index da1604441..70349bd15 100644 --- a/api.go +++ b/api.go @@ -874,7 +874,10 @@ func getContainersByName(srv *Server, version float64, w http.ResponseWriter, r return fmt.Errorf("Conflict between containers and images") } - return writeJSON(w, http.StatusOK, container) + container.readHostConfig() + c := APIContainer{container, container.hostConfig} + + return writeJSON(w, http.StatusOK, c) } func getImagesByName(srv *Server, version float64, w http.ResponseWriter, r *http.Request, vars map[string]string) error { diff --git a/api_params.go b/api_params.go index 8d65d475c..a1bdd3e14 100644 --- a/api_params.go +++ b/api_params.go @@ -118,6 +118,10 @@ type ( Resource string HostPath string } + APIContainer struct { + *Container + HostConfig *HostConfig + } ) func (api APIImages) ToLegacy() []APIImagesOld { From 664174c7aa1300b9a856eafafc01a1d416a731ff Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Mon, 2 Dec 2013 18:17:15 -0800 Subject: [PATCH 2/2] Add docs for hostconfig in inspect --- docs/sources/api/docker_remote_api.rst | 4 ++++ docs/sources/api/docker_remote_api_v1.8.rst | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/sources/api/docker_remote_api.rst b/docs/sources/api/docker_remote_api.rst index 4191e9a8e..f38a36ee1 100644 --- a/docs/sources/api/docker_remote_api.rst +++ b/docs/sources/api/docker_remote_api.rst @@ -51,6 +51,10 @@ What's new **New!** This endpoint now returns build status as json stream. In case of a build error, it returns the exit status of the failed command. +.. http:get:: /containers/(id)/json + + **New!** This endpoint now returns the host config for the container. + v1.7 **** diff --git a/docs/sources/api/docker_remote_api_v1.8.rst b/docs/sources/api/docker_remote_api_v1.8.rst index 8e960739b..1e0281761 100644 --- a/docs/sources/api/docker_remote_api_v1.8.rst +++ b/docs/sources/api/docker_remote_api_v1.8.rst @@ -222,7 +222,23 @@ Inspect a container }, "SysInitPath": "/home/kitty/go/src/github.com/dotcloud/docker/bin/docker", "ResolvConfPath": "/etc/resolv.conf", - "Volumes": {} + "Volumes": {}, + "HostConfig": { + "Binds": null, + "ContainerIDFile": "", + "LxcConf": [], + "Privileged": false, + "PortBindings": { + "80/tcp": [ + { + "HostIp": "0.0.0.0", + "HostPort": "49153" + } + ] + }, + "Links": null, + "PublishAllPorts": false + } } :statuscode 200: no error