mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 17:49:10 +00:00
Fix docker pull
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
parent
91e78b73b9
commit
0ade84e151
@ -176,7 +176,13 @@ func dockerPull(image string, trustedPull bool) error {
|
||||
return errors.New("could not initialize Docker API client")
|
||||
}
|
||||
|
||||
if _, err := cli.ImagePull(context.Background(), image, types.ImagePullOptions{}); err != nil {
|
||||
r, err := cli.ImagePull(context.Background(), image, types.ImagePullOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer r.Close()
|
||||
_, err = io.Copy(ioutil.Discard, r)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Debugf("docker pull: %s...Done", image)
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
"strings"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/client"
|
||||
)
|
||||
|
||||
// This uses Docker to convert a Docker image into a tarball. It would be an improvement if we
|
||||
@ -104,7 +103,7 @@ func imageTar(image, prefix string, tw *tar.Writer, trust bool, pull bool) error
|
||||
container, err := dockerCreate(image)
|
||||
if err != nil {
|
||||
// if the image wasn't found, pull it down. Bail on other errors.
|
||||
if client.IsErrNotFound(err) {
|
||||
if strings.Contains(err.Error(), "No such image") {
|
||||
log.Infof("Pull image: %s", image)
|
||||
err := dockerPull(image, trust)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user