Make podman commit to localhost rather then docker.io

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #715
Approved by: mheon
This commit is contained in:
Daniel J Walsh
2018-05-03 08:59:19 -04:00
committed by Atomic Bot
parent e6ec1aaffe
commit fae5033a01
7 changed files with 124 additions and 91 deletions

View File

@ -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, errors.Wrapf(err, "error parsing target image name %q", destImage)
}
id, err := importBuilder.Commit(ctx, imageRef, commitOptions)
if err != nil {
return nil, err
}
if err = importBuilder.Commit(ctx, imageRef, commitOptions); 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)
}