1
0
mirror of https://github.com/docker/docs.git synced 2026-10-31 10:34:26 +03:00

Merge pull request #596 from vieux/fix_docker_inspect

fix node field in docker inspect
This commit is contained in:
Alexandre Beslic
2015-04-08 14:12:16 -07:00

View File

@@ -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)