summaryrefslogtreecommitdiff
path: root/pkg/specgen/generate/container_create.go
diff options
context:
space:
mode:
authorcdoern <cbdoer23@g.holycross.edu>2022-04-28 22:37:11 -0400
committercdoern <cbdoer23@g.holycross.edu>2022-05-03 23:04:08 -0400
commit1585b175dbf47e7ee0d5a26600aaec898ec5c26b (patch)
tree9ec73b529ca361890dd06b973099561840e6c2e4 /pkg/specgen/generate/container_create.go
parentab3e072a0c3d321fd12cbd1f6ef8e322c6d9214a (diff)
downloadpodman-1585b175dbf47e7ee0d5a26600aaec898ec5c26b.tar.gz
podman-1585b175dbf47e7ee0d5a26600aaec898ec5c26b.tar.bz2
podman-1585b175dbf47e7ee0d5a26600aaec898ec5c26b.zip
pass networks to container clone
since the network config is a string map, json.unmarshal does not recognize the config and spec as the same entity, need to map this option manually resolves #13713 Signed-off-by: cdoern <cbdoer23@g.holycross.edu>
Diffstat (limited to 'pkg/specgen/generate/container_create.go')
-rw-r--r--pkg/specgen/generate/container_create.go16
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 {