summaryrefslogtreecommitdiff
path: root/libpod/container_inspect.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-07-15 04:50:40 -0400
committerGitHub <noreply@github.com>2020-07-15 04:50:40 -0400
commit6224f3f5d5f651a5bbfdc15407288d08d7af33ea (patch)
tree56476ca94445886e46f55f574fb5ad4e752ab95b /libpod/container_inspect.go
parentc4843d4e9ce395f1bbcaae848e6172f5a4519a35 (diff)
parentfbc1167c4d7861013001d0c2460c6e1c1e1ad66d (diff)
downloadpodman-6224f3f5d5f651a5bbfdc15407288d08d7af33ea.tar.gz
podman-6224f3f5d5f651a5bbfdc15407288d08d7af33ea.tar.bz2
podman-6224f3f5d5f651a5bbfdc15407288d08d7af33ea.zip
Merge pull request #6956 from mheon/add_ports_to_pod_inspect
Include infra container information in `pod inspect`
Diffstat (limited to 'libpod/container_inspect.go')
-rw-r--r--libpod/container_inspect.go17
1 files changed, 3 insertions, 14 deletions
diff --git a/libpod/container_inspect.go b/libpod/container_inspect.go
index b1d86b0a5..680776dba 100644
--- a/libpod/container_inspect.go
+++ b/libpod/container_inspect.go
@@ -613,22 +613,11 @@ func (c *Container) generateInspectContainerHostConfig(ctrSpec *spec.Spec, named
// Port bindings.
// Only populate if we're using CNI to configure the network.
- portBindings := make(map[string][]define.InspectHostPort)
if c.config.CreateNetNS {
- for _, port := range c.config.PortMappings {
- key := fmt.Sprintf("%d/%s", port.ContainerPort, port.Protocol)
- hostPorts := portBindings[key]
- if hostPorts == nil {
- hostPorts = []define.InspectHostPort{}
- }
- hostPorts = append(hostPorts, define.InspectHostPort{
- HostIP: port.HostIP,
- HostPort: fmt.Sprintf("%d", port.HostPort),
- })
- portBindings[key] = hostPorts
- }
+ hostConfig.PortBindings = makeInspectPortBindings(c.config.PortMappings)
+ } else {
+ hostConfig.PortBindings = make(map[string][]define.InspectHostPort)
}
- hostConfig.PortBindings = portBindings
// Cap add and cap drop.
// We need a default set of capabilities to compare against.