summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorcdoern <cbdoer23@g.holycross.edu>2022-04-28 22:37:11 -0400
committerMatthew Heon <matthew.heon@pm.me>2022-05-05 16:02:00 -0400
commita8b55a3b9f8f2395d0d8ac3a4112fb3ff30da630 (patch)
tree9278e03278b954bef7e71a80bd38acbecba09e1e /libpod
parentb2025c64f43e74c84fb928f07df7bab3f776fe2d (diff)
downloadpodman-a8b55a3b9f8f2395d0d8ac3a4112fb3ff30da630.tar.gz
podman-a8b55a3b9f8f2395d0d8ac3a4112fb3ff30da630.tar.bz2
podman-a8b55a3b9f8f2395d0d8ac3a4112fb3ff30da630.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 'libpod')
-rw-r--r--libpod/container.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/libpod/container.go b/libpod/container.go
index 3e7ab7b0a..457b290b7 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -288,6 +288,15 @@ func (c *Container) Config() *ContainerConfig {
return nil
}
+ if c != nil {
+ networks, err := c.networks()
+ if err != nil {
+ return nil
+ }
+
+ returnConfig.Networks = networks
+ }
+
return returnConfig
}
@@ -1260,7 +1269,10 @@ func (c *Container) NetworkMode() string {
// Unlocked accessor for networks
func (c *Container) networks() (map[string]types.PerNetworkOptions, error) {
- return c.runtime.state.GetNetworks(c)
+ if c != nil && c.runtime != nil && c.runtime.state != nil { // can fail if c.networks is called from the tests
+ return c.runtime.state.GetNetworks(c)
+ }
+ return nil, nil
}
// getInterfaceByName returns a formatted interface name for a given