From fa1ad4f54e767bc9723659f6b5c1f21527b19151 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 e8763a0d..47a6d730 100644 --- a/server/container_create.go +++ b/server/container_create.go @@ -1013,7 +1013,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)