mirror of
https://github.com/containers/podman.git
synced 2025-05-17 15:18:43 +08:00
podman inspect show exposed ports
Podman inspect has to show exposed ports to match docker. This requires storing the exposed ports in the container config. A exposed port is shown as `"80/tcp": null` while a forwarded port is shown as `"80/tcp": [{"HostIp": "", "HostPort": "8080" }]`. Also make sure to add the exposed ports to the new image when the container is commited. Fixes #10777 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -99,6 +99,11 @@ func (c *Container) Commit(ctx context.Context, destImage string, options Contai
|
||||
for _, p := range c.config.PortMappings {
|
||||
importBuilder.SetPort(fmt.Sprintf("%d/%s", p.ContainerPort, p.Protocol))
|
||||
}
|
||||
for port, protocols := range c.config.ExposedPorts {
|
||||
for _, protocol := range protocols {
|
||||
importBuilder.SetPort(fmt.Sprintf("%d/%s", port, protocol))
|
||||
}
|
||||
}
|
||||
// Labels
|
||||
for k, v := range c.Labels() {
|
||||
importBuilder.SetLabel(k, v)
|
||||
|
Reference in New Issue
Block a user