summaryrefslogtreecommitdiff
path: root/libpod/container_commit.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-05-03 08:59:19 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-05-03 13:12:46 +0000
commitfae5033a01b78d3e8f23c1c9438bc5534dfe0fa3 (patch)
treee2a140a0493f23a8e3a1a6cfff04a826ef9fe12e /libpod/container_commit.go
parente6ec1aaffe791a265ca7716813de47dacc4b70e8 (diff)
downloadpodman-fae5033a01b78d3e8f23c1c9438bc5534dfe0fa3.tar.gz
podman-fae5033a01b78d3e8f23c1c9438bc5534dfe0fa3.tar.bz2
podman-fae5033a01b78d3e8f23c1c9438bc5534dfe0fa3.zip
Make podman commit to localhost rather then docker.io
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #715 Approved by: mheon
Diffstat (limited to 'libpod/container_commit.go')
-rw-r--r--libpod/container_commit.go14
1 files changed, 10 insertions, 4 deletions
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)
}