mirror of
https://github.com/containers/podman.git
synced 2025-08-26 03:01:31 +08:00
Return imageid from podman pull
When using podman to pull an image, print the image id after the image is pulled. Resolves issue #329 Signed-off-by: baude <bbaude@redhat.com> Closes: #342 Approved by: rhatdan
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"fmt"
|
||||
"github.com/containers/image/types"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/projectatomic/libpod/libpod"
|
||||
@ -106,5 +107,13 @@ func pullCmd(c *cli.Context) error {
|
||||
if _, err := runtime.PullImage(image, options); err != nil {
|
||||
return errors.Wrapf(err, "error pulling image %q", image)
|
||||
}
|
||||
|
||||
newImage := runtime.NewImage(image)
|
||||
iid, err := newImage.GetImageID()
|
||||
// Intentially choosing to ignore if there is an error because
|
||||
// outputting the image ID is a NTH and not integral to the pull
|
||||
if err == nil {
|
||||
fmt.Println(iid)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user