diff options
Diffstat (limited to 'libpod/container.go')
-rw-r--r-- | libpod/container.go | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/libpod/container.go b/libpod/container.go index 3e7ab7b0a..4b2af02ab 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -281,12 +281,29 @@ type ContainerNetworkDescriptions map[string]int // Config accessors // Unlocked -// Config returns the configuration used to create the container +// Config returns the configuration used to create the container. +// Note that the returned config does not include the actual networks. +// Use ConfigWithNetworks() if you need them. func (c *Container) Config() *ContainerConfig { returnConfig := new(ContainerConfig) if err := JSONDeepCopy(c.config, returnConfig); err != nil { return nil } + return returnConfig +} + +// Config returns the configuration used to create the container. +func (c *Container) ConfigWithNetworks() *ContainerConfig { + returnConfig := c.Config() + if returnConfig == nil { + return nil + } + + networks, err := c.networks() + if err != nil { + return nil + } + returnConfig.Networks = networks return returnConfig } |