mirror of
https://github.com/containers/podman.git
synced 2025-06-01 17:17:47 +08:00
Print port mappings in ps
for ctrs sharing network
In Podman v1.9, we printed port mappings for the container, even if it shared its network namespace (and thus ports) with another container. We regressed on this in Podman v2.0, which is fixed here. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
@ -145,11 +145,15 @@ func ListContainerBatch(rt *libpod.Runtime, ctr *libpod.Container, opts entities
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
if batchErr != nil {
|
||||
return entities.ListContainer{}, batchErr
|
||||
}
|
||||
|
||||
portMappings, err := ctr.PortMappings()
|
||||
if err != nil {
|
||||
return entities.ListContainer{}, err
|
||||
}
|
||||
|
||||
ps := entities.ListContainer{
|
||||
Command: conConfig.Command,
|
||||
Created: conConfig.CreatedTime.Unix(),
|
||||
@ -165,7 +169,7 @@ func ListContainerBatch(rt *libpod.Runtime, ctr *libpod.Container, opts entities
|
||||
Names: []string{conConfig.Name},
|
||||
Pid: pid,
|
||||
Pod: conConfig.Pod,
|
||||
Ports: conConfig.PortMappings,
|
||||
Ports: portMappings,
|
||||
Size: size,
|
||||
StartedAt: startedTime.Unix(),
|
||||
State: conState.String(),
|
||||
|
Reference in New Issue
Block a user