summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-10-20 17:07:11 -0400
committerGitHub <noreply@github.com>2020-10-20 17:07:11 -0400
commit94873a237ab52db27916b8954e489fe780eea069 (patch)
tree216d88f10e261644c8f287d20495adeaaaad1eae /libpod
parent4822cc8cabce33732cb210103aaa208f81102c5d (diff)
parentc1b844ecc8620f446e95253e9a5124a628576e57 (diff)
downloadpodman-94873a237ab52db27916b8954e489fe780eea069.tar.gz
podman-94873a237ab52db27916b8954e489fe780eea069.tar.bz2
podman-94873a237ab52db27916b8954e489fe780eea069.zip
Merge pull request #8075 from mheon/fix_8073
Retrieve network inspect info from dependency container
Diffstat (limited to 'libpod')
-rw-r--r--libpod/networking_linux.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go
index f87c311ce..df0ff6c32 100644
--- a/libpod/networking_linux.go
+++ b/libpod/networking_linux.go
@@ -823,6 +823,20 @@ func getContainerNetIO(ctr *Container) (*netlink.LinkStatistics, error) {
// Produce an InspectNetworkSettings containing information on the container
// network.
func (c *Container) getContainerNetworkInfo() (*define.InspectNetworkSettings, error) {
+ if c.config.NetNsCtr != "" {
+ netNsCtr, err := c.runtime.GetContainer(c.config.NetNsCtr)
+ if err != nil {
+ return nil, err
+ }
+ // Have to sync to ensure that state is populated
+ if err := netNsCtr.syncContainer(); err != nil {
+ return nil, err
+ }
+ logrus.Debugf("Container %s shares network namespace, retrieving network info of container %s", c.ID(), c.config.NetNsCtr)
+
+ return netNsCtr.getContainerNetworkInfo()
+ }
+
settings := new(define.InspectNetworkSettings)
settings.Ports = makeInspectPortBindings(c.config.PortMappings)