aboutsummaryrefslogtreecommitdiff
path: root/libpod/container_commit.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2019-01-02 10:26:34 -0500
committerMatthew Heon <matthew.heon@pm.me>2019-01-02 10:26:44 -0500
commit9c7d5121364b25adfb35b5ac8f58bd949e0d12cb (patch)
treee1cc86d17eeac682d3cedb41ba725978663acaa4 /libpod/container_commit.go
parent7438b7bd3afb9e5a0fc761fdc8532cd697f2187b (diff)
downloadpodman-9c7d5121364b25adfb35b5ac8f58bd949e0d12cb.tar.gz
podman-9c7d5121364b25adfb35b5ac8f58bd949e0d12cb.tar.bz2
podman-9c7d5121364b25adfb35b5ac8f58bd949e0d12cb.zip
Use sprintf to generate port numbers while committing
Casting integers to strings is definitely not correct, so let the standard library handle matters. Fixes #2066 Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod/container_commit.go')
-rw-r--r--libpod/container_commit.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/libpod/container_commit.go b/libpod/container_commit.go
index dabd224d5..026611e51 100644
--- a/libpod/container_commit.go
+++ b/libpod/container_commit.go
@@ -2,6 +2,7 @@ package libpod
import (
"context"
+ "fmt"
"strings"
"github.com/containers/buildah"
@@ -101,7 +102,7 @@ func (c *Container) Commit(ctx context.Context, destImage string, options Contai
}
// Expose ports
for _, p := range c.config.PortMappings {
- importBuilder.SetPort(string(p.ContainerPort))
+ importBuilder.SetPort(fmt.Sprintf("%d", p.ContainerPort))
}
// Labels
for k, v := range c.Labels() {