aboutsummaryrefslogtreecommitdiff
path: root/libpod/container_inspect.go
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2020-07-13 14:22:43 -0400
committerMatthew Heon <mheon@redhat.com>2020-07-14 12:03:11 -0400
commit41457b5a28532d410517b1afb1759e2724d03cab (patch)
tree9d0f6a2e28c8ffdb4366bd3482b2cf5fd255be9e /libpod/container_inspect.go
parent210f1040d26334457803bc1da74667f70630a620 (diff)
downloadpodman-41457b5a28532d410517b1afb1759e2724d03cab.tar.gz
podman-41457b5a28532d410517b1afb1759e2724d03cab.tar.bz2
podman-41457b5a28532d410517b1afb1759e2724d03cab.zip
Include infra container information in `pod inspect`
We had a field for this in the inspect data, but it was never being populated. Because of this, `podman pod inspect` stopped showing port bindings (and other infra container settings). Add code to populate the infra container inspect data, and add a test to ensure we don't regress again. Signed-off-by: Matthew Heon <mheon@redhat.com>
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 94d5dc93b..dad69311f 100644
--- a/libpod/container_inspect.go
+++ b/libpod/container_inspect.go
@@ -612,22 +612,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.