mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-03 18:07:41 +08:00
Merge pull request #2988 from crazy-max/ctn-driver-display-pull-error
docker-container: check error from response body when pulling image
This commit is contained in:
commit
2389d457a4
@ -26,6 +26,7 @@ import (
|
|||||||
"github.com/docker/docker/errdefs"
|
"github.com/docker/docker/errdefs"
|
||||||
dockerarchive "github.com/docker/docker/pkg/archive"
|
dockerarchive "github.com/docker/docker/pkg/archive"
|
||||||
"github.com/docker/docker/pkg/idtools"
|
"github.com/docker/docker/pkg/idtools"
|
||||||
|
"github.com/docker/docker/pkg/jsonmessage"
|
||||||
"github.com/docker/docker/pkg/stdcopy"
|
"github.com/docker/docker/pkg/stdcopy"
|
||||||
"github.com/moby/buildkit/client"
|
"github.com/moby/buildkit/client"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
@ -94,14 +95,14 @@ func (d *Driver) create(ctx context.Context, l progress.SubLogger) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
rc, err := d.DockerAPI.ImageCreate(ctx, imageName, image.CreateOptions{
|
resp, err := d.DockerAPI.ImageCreate(ctx, imageName, image.CreateOptions{
|
||||||
RegistryAuth: ra,
|
RegistryAuth: ra,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
_, err = io.Copy(io.Discard, rc)
|
defer resp.Close()
|
||||||
return err
|
return jsonmessage.DisplayJSONMessagesStream(resp, io.Discard, 0, false, nil)
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
// image pulling failed, check if it exists in local image store.
|
// image pulling failed, check if it exists in local image store.
|
||||||
// if not, return pulling error. otherwise log it.
|
// if not, return pulling error. otherwise log it.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user