From 55691e5fdc78b5c3015c7a481371e482878c14d2 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Wed, 25 Jun 2014 22:24:14 +0000 Subject: [PATCH 1/2] add links to inspect for 'linking' containers Docker-DCO-1.1-Signed-off-by: Victor Vieux (github: vieux) --- daemon/inspect.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/daemon/inspect.go b/daemon/inspect.go index 6c4b74d6f2..b93aec5059 100644 --- a/daemon/inspect.go +++ b/daemon/inspect.go @@ -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) } From 250b0d070c7d8fce3d75bafc02c31ab3e356ba2e Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Thu, 26 Jun 2014 23:36:29 +0000 Subject: [PATCH 2/2] add doc Docker-DCO-1.1-Signed-off-by: Victor Vieux (github: vieux) --- docs/sources/reference/api/docker_remote_api.md | 5 +++++ docs/sources/reference/api/docker_remote_api_v1.13.md | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/sources/reference/api/docker_remote_api.md b/docs/sources/reference/api/docker_remote_api.md index b623167c4a..ff337b379a 100644 --- a/docs/sources/reference/api/docker_remote_api.md +++ b/docs/sources/reference/api/docker_remote_api.md @@ -34,6 +34,11 @@ You can still call an old version of the API using ### What's new +`GET /containers/(name)/json` + +**New!** +The `HostConfig.Links` field is now filled correctly + **New!** `Sockets` parameter added to the `/info` endpoint listing all the sockets the daemon is configured to listen on. diff --git a/docs/sources/reference/api/docker_remote_api_v1.13.md b/docs/sources/reference/api/docker_remote_api_v1.13.md index e92b130faa..286c7e1852 100644 --- a/docs/sources/reference/api/docker_remote_api_v1.13.md +++ b/docs/sources/reference/api/docker_remote_api_v1.13.md @@ -240,7 +240,7 @@ Return low-level information on the container `id` } ] }, - "Links": null, + "Links": ["/name:alias"], "PublishAllPorts": false } }