From 4c3e195db36e67d65bebd48b9987596799d9d543 Mon Sep 17 00:00:00 2001 From: Phil Estes Date: Wed, 5 Sep 2018 12:04:40 -0400 Subject: [PATCH] Add HOSTNAME to env by default for pod containers To match expectations of users coming from Docker engine runtime, add the HOSTNAME to the environment of new containers in a pod. Signed-off-by: Phil Estes --- pkg/server/container_create.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/server/container_create.go b/pkg/server/container_create.go index 69bd05997..9e7f2c6c7 100644 --- a/pkg/server/container_create.go +++ b/pkg/server/container_create.go @@ -341,6 +341,8 @@ func (c *criService) generateContainerSpec(id string, sandboxID string, sandboxP for _, e := range config.GetEnvs() { g.AddProcessEnv(e.GetKey(), e.GetValue()) } + // add the HOSTNAME variable to the environment to match Docker runtime default + g.AddProcessEnv("HOSTNAME", sandboxConfig.GetHostname()) securityContext := config.GetLinux().GetSecurityContext() selinuxOpt := securityContext.GetSelinuxOptions()