From d1c41e0d4307c01b4639c87f805fa32c91d87724 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Wed, 8 Apr 2015 14:09:57 -0700 Subject: [PATCH] fix node field in docker inspect Signed-off-by: Victor Vieux --- api/api.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/api/api.go b/api/api.go index dc5e55e189..d20f31ad73 100644 --- a/api/api.go +++ b/api/api.go @@ -188,8 +188,14 @@ func getContainerJSON(c *context, w http.ResponseWriter, r *http.Request) { return } + n, err := json.Marshal(container.Engine) + if err != nil { + httpError(w, err.Error(), http.StatusInternalServerError) + return + } + // insert Node field - data = bytes.Replace(data, []byte("\"Name\":\"/"), []byte(fmt.Sprintf("\"Node\":%s,\"Name\":\"/", container.Engine)), -1) + data = bytes.Replace(data, []byte("\"Name\":\"/"), []byte(fmt.Sprintf("\"Node\":%s,\"Name\":\"/", n)), -1) // insert node IP data = bytes.Replace(data, []byte("\"HostIp\":\"0.0.0.0\""), []byte(fmt.Sprintf("\"HostIp\":%q", container.Engine.IP)), -1)