diff options
Diffstat (limited to 'cmd/kpod/spec.go')
-rw-r--r-- | cmd/kpod/spec.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cmd/kpod/spec.go b/cmd/kpod/spec.go index 611a3cc56..d31f9c8ed 100644 --- a/cmd/kpod/spec.go +++ b/cmd/kpod/spec.go @@ -52,6 +52,9 @@ func createConfigToOCISpec(config *createConfig) (*spec.Spec, error) { } g.SetRootReadonly(config.readOnlyRootfs) g.SetHostname(config.hostname) + if config.hostname != "" { + g.AddProcessEnv("HOSTNAME", config.hostname) + } for _, sysctl := range config.sysctl { s := strings.SplitN(sysctl, "=", 2) @@ -124,6 +127,10 @@ func createConfigToOCISpec(config *createConfig) (*spec.Spec, error) { g.AddTmpfsMount(spliti[0], options) } + for name, val := range config.env { + g.AddProcessEnv(name, val) + } + configSpec := g.Spec() if config.seccompProfilePath != "" && config.seccompProfilePath != "unconfined" { @@ -138,8 +145,6 @@ func createConfigToOCISpec(config *createConfig) (*spec.Spec, error) { configSpec.Linux.Seccomp = &seccompConfig } - configSpec.Process.Env = config.env - // BIND MOUNTS configSpec.Mounts = append(configSpec.Mounts, config.GetVolumeMounts()...) |