From 6cf519a8e17fc9c3e446480b6c89686ac82354d2 Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Tue, 26 Jul 2016 11:53:39 -0700 Subject: [PATCH] Label containers with stack name when deploying stack/bundle This fix tries to address the issue raised in 24881 where the stack name is not visable when inspecting containers deployed through stacks. This fix adds `labelNamespace` (`com.docker.stack.namespace`) to containers at the client side so that the stack name label will show up after containers are deployed. This fix is tested manually: - Build the binary with `make DOCKER_EXPERIMENTAL=1` - Create a bundle file and deploy with the `docker stack deploy` - Verify that `com.docker.stack.namespace` has been set properly by checking contaners with `docker inspect ` This fix fixes 24881. Signed-off-by: Yong Tang Upstream-commit: 796636716d547dc7c37ff98950ba2c662143e555 Component: engine --- components/engine/api/client/stack/deploy.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/engine/api/client/stack/deploy.go b/components/engine/api/client/stack/deploy.go index 5a1a5a5318..c3258f1778 100644 --- a/components/engine/api/client/stack/deploy.go +++ b/components/engine/api/client/stack/deploy.go @@ -168,6 +168,10 @@ func deployServices( Command: service.Command, Args: service.Args, Env: service.Env, + // Service Labels will not be copied to Containers + // automatically during the deployment so we apply + // it here. + Labels: getStackLabels(namespace, nil), }, }, EndpointSpec: &swarm.EndpointSpec{