podman ps: show exposed ports under PORTS as well

Docker shows exposed ports as just PORT/PROTO so match that behavior. It
is not clear to me why someone needs that information in ps as "expose"
doesn't effect anything networking related.

Fixes https://issues.redhat.com/browse/RHEL-32154

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2024-04-09 15:45:44 +02:00
parent b59993ce09
commit 0bedf7f1d2
5 changed files with 60 additions and 31 deletions

View File

@ -238,29 +238,30 @@ func ListContainerBatch(rt *libpod.Runtime, ctr *libpod.Container, opts entities
}
ps := entities.ListContainer{
AutoRemove: ctr.AutoRemove(),
CIDFile: conConfig.Spec.Annotations[define.InspectAnnotationCIDFile],
Command: conConfig.Command,
Created: conConfig.CreatedTime,
ExitCode: exitCode,
Exited: exited,
ExitedAt: exitedTime.Unix(),
ID: conConfig.ID,
Image: conConfig.RootfsImageName,
ImageID: conConfig.RootfsImageID,
IsInfra: conConfig.IsInfra,
Labels: conConfig.Labels,
Mounts: ctr.UserVolumes(),
Names: []string{conConfig.Name},
Networks: networks,
Pid: pid,
Pod: conConfig.Pod,
Ports: portMappings,
Restarts: restartCount,
Size: size,
StartedAt: startedTime.Unix(),
State: conState.String(),
Status: healthStatus,
AutoRemove: ctr.AutoRemove(),
CIDFile: conConfig.Spec.Annotations[define.InspectAnnotationCIDFile],
Command: conConfig.Command,
Created: conConfig.CreatedTime,
ExitCode: exitCode,
Exited: exited,
ExitedAt: exitedTime.Unix(),
ExposedPorts: conConfig.ExposedPorts,
ID: conConfig.ID,
Image: conConfig.RootfsImageName,
ImageID: conConfig.RootfsImageID,
IsInfra: conConfig.IsInfra,
Labels: conConfig.Labels,
Mounts: ctr.UserVolumes(),
Names: []string{conConfig.Name},
Networks: networks,
Pid: pid,
Pod: conConfig.Pod,
Ports: portMappings,
Restarts: restartCount,
Size: size,
StartedAt: startedTime.Unix(),
State: conState.String(),
Status: healthStatus,
}
if opts.Pod && len(conConfig.Pod) > 0 {
podName, err := rt.GetPodName(conConfig.Pod)