1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #6683 from vieux/add_links_inspect

add links to inspect for 'linking' containers
This commit is contained in:
Michael Crosby 2014-06-26 17:33:02 -07:00
commit e35a9a7def
3 changed files with 16 additions and 1 deletions

View file

@ -2,6 +2,7 @@ package daemon
import ( import (
"encoding/json" "encoding/json"
"fmt"
"github.com/dotcloud/docker/engine" "github.com/dotcloud/docker/engine"
"github.com/dotcloud/docker/runconfig" "github.com/dotcloud/docker/runconfig"
@ -46,7 +47,16 @@ func (daemon *Daemon) ContainerInspect(job *engine.Job) engine.Status {
out.Set("ProcessLabel", container.ProcessLabel) out.Set("ProcessLabel", container.ProcessLabel)
out.SetJson("Volumes", container.Volumes) out.SetJson("Volumes", container.Volumes)
out.SetJson("VolumesRW", container.VolumesRW) out.SetJson("VolumesRW", container.VolumesRW)
if children, err := daemon.Children(container.Name); err == nil {
for linkAlias, child := range children {
container.hostConfig.Links = append(container.hostConfig.Links, fmt.Sprintf("%s:%s", child.Name, linkAlias))
}
}
out.SetJson("HostConfig", container.hostConfig) out.SetJson("HostConfig", container.hostConfig)
container.hostConfig.Links = nil
if _, err := out.WriteTo(job.Stdout); err != nil { if _, err := out.WriteTo(job.Stdout); err != nil {
return job.Error(err) return job.Error(err)
} }

View file

@ -34,6 +34,11 @@ You can still call an old version of the API using
### What's new ### What's new
`GET /containers/(name)/json`
**New!**
The `HostConfig.Links` field is now filled correctly
**New!** **New!**
`Sockets` parameter added to the `/info` endpoint listing all the sockets the `Sockets` parameter added to the `/info` endpoint listing all the sockets the
daemon is configured to listen on. daemon is configured to listen on.

View file

@ -240,7 +240,7 @@ Return low-level information on the container `id`
} }
] ]
}, },
"Links": null, "Links": ["/name:alias"],
"PublishAllPorts": false "PublishAllPorts": false
} }
} }