diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-08-23 11:04:31 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-23 11:04:31 -0400 |
commit | 8a32e516f7a29766b8aa54991d1b3987acd479bf (patch) | |
tree | ecf0ba235129d473bd9eef8b05954fe692087bb4 /pkg/specgen | |
parent | 5948320951e17a60da848ba16e3c7aed1676129a (diff) | |
parent | 53369aaa1575caa652461d3671713577fa0ac291 (diff) | |
download | podman-8a32e516f7a29766b8aa54991d1b3987acd479bf.tar.gz podman-8a32e516f7a29766b8aa54991d1b3987acd479bf.tar.bz2 podman-8a32e516f7a29766b8aa54991d1b3987acd479bf.zip |
Merge pull request #15415 from cdoern/clone
pass environment variables to container clone
Diffstat (limited to 'pkg/specgen')
-rw-r--r-- | pkg/specgen/generate/container.go | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/pkg/specgen/generate/container.go b/pkg/specgen/generate/container.go index ec85f0f79..85cd8f5ca 100644 --- a/pkg/specgen/generate/container.go +++ b/pkg/specgen/generate/container.go @@ -347,9 +347,21 @@ func ConfigToSpec(rt *libpod.Runtime, specg *specgen.SpecGenerator, contaierID s conf.Systemd = tmpSystemd conf.Mounts = tmpMounts - if conf.Spec != nil && conf.Spec.Linux != nil && conf.Spec.Linux.Resources != nil { - if specg.ResourceLimits == nil { - specg.ResourceLimits = conf.Spec.Linux.Resources + if conf.Spec != nil { + if conf.Spec.Linux != nil && conf.Spec.Linux.Resources != nil { + if specg.ResourceLimits == nil { + specg.ResourceLimits = conf.Spec.Linux.Resources + } + } + if conf.Spec.Process != nil && conf.Spec.Process.Env != nil { + env := make(map[string]string) + for _, entry := range conf.Spec.Process.Env { + split := strings.Split(entry, "=") + if len(split) == 2 { + env[split[0]] = split[1] + } + } + specg.Env = env } } |