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)