From fae5033a01b78d3e8f23c1c9438bc5534dfe0fa3 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Thu, 3 May 2018 08:59:19 -0400 Subject: Make podman commit to localhost rather then docker.io Signed-off-by: Daniel J Walsh Closes: #715 Approved by: mheon --- libpod/container_commit.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'libpod') diff --git a/libpod/container_commit.go b/libpod/container_commit.go index 568fad9f7..190a3be97 100644 --- a/libpod/container_commit.go +++ b/libpod/container_commit.go @@ -8,6 +8,7 @@ import ( is "github.com/containers/image/storage" "github.com/pkg/errors" "github.com/projectatomic/buildah" + "github.com/projectatomic/buildah/util" "github.com/projectatomic/libpod/libpod/image" "github.com/sirupsen/logrus" ) @@ -132,13 +133,18 @@ func (c *Container) Commit(ctx context.Context, destImage string, options Contai importBuilder.SetWorkDir(splitChange[1]) } } - imageRef, err := is.Transport.ParseStoreReference(c.runtime.store, destImage) + candidates := util.ResolveName(destImage, "", sc, c.runtime.store) + if len(candidates) == 0 { + return nil, errors.Errorf("error parsing target image name %q", destImage) + } + imageRef, err := is.Transport.ParseStoreReference(c.runtime.store, candidates[0]) if err != nil { - return nil, err + return nil, errors.Wrapf(err, "error parsing target image name %q", destImage) } - if err = importBuilder.Commit(ctx, imageRef, commitOptions); err != nil { + id, err := importBuilder.Commit(ctx, imageRef, commitOptions) + if err != nil { return nil, err } fmt.Fprintf(commitOptions.ReportWriter, importBuilder.Comment()) - return c.runtime.imageRuntime.NewFromLocal(imageRef.DockerReference().String()) + return c.runtime.imageRuntime.NewFromLocal(id) } -- cgit v1.2.3-54-g00ecf