From 7e1e21f1f4507bd21e6638c117737d4f300dc34a Mon Sep 17 00:00:00 2001 From: Mrunal Patel Date: Thu, 2 Nov 2017 10:20:45 -0700 Subject: [PATCH] Add HOSTNAME env var to container Signed-off-by: Mrunal Patel --- server/container_create.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/container_create.go b/server/container_create.go index 04f7c2ea..6501db79 100644 --- a/server/container_create.go +++ b/server/container_create.go @@ -912,7 +912,9 @@ func (s *Server) createSandboxContainer(ctx context.Context, containerID string, specgen.AddBindMount("/etc/hosts", "/etc/hosts", options) } + // Set hostname and add env for hostname specgen.SetHostname(sb.Hostname()) + specgen.AddProcessEnv("HOSTNAME", sb.Hostname()) specgen.AddAnnotation(annotations.Name, containerName) specgen.AddAnnotation(annotations.ContainerID, containerID)