summaryrefslogtreecommitdiff
path: root/libpod/container_commit.go
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2021-08-24 10:23:10 +0200
committerPaul Holzinger <pholzing@redhat.com>2021-08-24 15:44:26 +0200
commit4b2dc48d0bcde9d9dccb05f829019a52f3eddec7 (patch)
tree71ea2ef8e45e73de5ba47c707ab15d7edb8a15e3 /libpod/container_commit.go
parent2de56a5f41473e8f759972ec568089e9cddc0f98 (diff)
downloadpodman-4b2dc48d0bcde9d9dccb05f829019a52f3eddec7.tar.gz
podman-4b2dc48d0bcde9d9dccb05f829019a52f3eddec7.tar.bz2
podman-4b2dc48d0bcde9d9dccb05f829019a52f3eddec7.zip
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>
Diffstat (limited to 'libpod/container_commit.go')
-rw-r--r--libpod/container_commit.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/libpod/container_commit.go b/libpod/container_commit.go
index c1dd42942..87e5d511c 100644
--- a/libpod/container_commit.go
+++ b/libpod/container_commit.go
@@ -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)