mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
add links to inspect for 'linking' containers
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
This commit is contained in:
parent
94370add05
commit
55691e5fdc
1 changed files with 10 additions and 0 deletions
|
@ -2,6 +2,7 @@ package daemon
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/dotcloud/docker/engine"
|
||||
"github.com/dotcloud/docker/runconfig"
|
||||
|
@ -46,7 +47,16 @@ func (daemon *Daemon) ContainerInspect(job *engine.Job) engine.Status {
|
|||
out.Set("ProcessLabel", container.ProcessLabel)
|
||||
out.SetJson("Volumes", container.Volumes)
|
||||
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)
|
||||
|
||||
container.hostConfig.Links = nil
|
||||
if _, err := out.WriteTo(job.Stdout); err != nil {
|
||||
return job.Error(err)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue