Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Commit 4c3e195

Browse files
committed
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 <[email protected]>
1 parent 4987757 commit 4c3e195

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

pkg/server/container_create.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@ func (c *criService) generateContainerSpec(id string, sandboxID string, sandboxP
341341
for _, e := range config.GetEnvs() {
342342
g.AddProcessEnv(e.GetKey(), e.GetValue())
343343
}
344+
// add the HOSTNAME variable to the environment to match Docker runtime default
345+
g.AddProcessEnv("HOSTNAME", sandboxConfig.GetHostname())
344346

345347
securityContext := config.GetLinux().GetSecurityContext()
346348
selinuxOpt := securityContext.GetSelinuxOptions()

0 commit comments

Comments
 (0)