diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-05-06 09:27:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-06 09:27:17 -0400 |
commit | f40474521b577153e960ea1dd9601b67307aeede (patch) | |
tree | ffd7d17ec55125c13fbce511fdc0a404f45e2555 /pkg/specgen/generate/container_create.go | |
parent | 83ef2c721ad438256b136b3491e504a6e70b64c9 (diff) | |
parent | ab4d33e146eab7cd685bb266e38ca62782642036 (diff) | |
download | podman-f40474521b577153e960ea1dd9601b67307aeede.tar.gz podman-f40474521b577153e960ea1dd9601b67307aeede.tar.bz2 podman-f40474521b577153e960ea1dd9601b67307aeede.zip |
Merge pull request #14132 from mheon/bump_410
Bump to v4.1.0
Diffstat (limited to 'pkg/specgen/generate/container_create.go')
-rw-r--r-- | pkg/specgen/generate/container_create.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go index 8b9ed8ffe..19a2b702c 100644 --- a/pkg/specgen/generate/container_create.go +++ b/pkg/specgen/generate/container_create.go @@ -175,13 +175,15 @@ func MakeContainer(ctx context.Context, rt *libpod.Runtime, s *specgen.SpecGener return nil, nil, nil, errors.New("the given container could not be retrieved") } conf := c.Config() - out, err := json.Marshal(conf.Spec.Linux) - if err != nil { - return nil, nil, nil, err - } - err = json.Unmarshal(out, runtimeSpec.Linux) - if err != nil { - return nil, nil, nil, err + if conf != nil && conf.Spec != nil && conf.Spec.Linux != nil { + out, err := json.Marshal(conf.Spec.Linux) + if err != nil { + return nil, nil, nil, err + } + err = json.Unmarshal(out, runtimeSpec.Linux) + if err != nil { + return nil, nil, nil, err + } } if s.ResourceLimits != nil { switch { |