From 9c7d5121364b25adfb35b5ac8f58bd949e0d12cb Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Wed, 2 Jan 2019 10:26:34 -0500 Subject: 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 --- libpod/container_commit.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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() { -- cgit v1.2.3-54-g00ecf