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 <estesp@linux.vnet.ibm.com>
This commit is contained in:
Phil Estes 2018-09-05 12:04:40 -04:00
parent 49877571e9
commit 4c3e195db3
No known key found for this signature in database
GPG Key ID: 0F386284C03A1162

View File

@ -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()