driver/docker-container: remove uses of jsonmessage
This function was always using `io.Discard` for printing the progress, so we can use the `Wait()` method, which reads the stream, returning any error (similar to jsonmessage.DisplayJSONMessagesStream), and closes the stream either if the context is cancelled, or if the stream ends. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -28,7 +28,6 @@ import (
|
||||
"github.com/moby/moby/api/types/container"
|
||||
"github.com/moby/moby/api/types/mount"
|
||||
dockerclient "github.com/moby/moby/client"
|
||||
"github.com/moby/moby/client/pkg/jsonmessage"
|
||||
"github.com/moby/moby/client/pkg/security"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
@@ -104,8 +103,7 @@ func (d *Driver) create(ctx context.Context, l progress.SubLogger) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer resp.Close()
|
||||
return jsonmessage.DisplayStream(resp, io.Discard)
|
||||
return resp.Wait(ctx)
|
||||
}); err != nil {
|
||||
// image pulling failed, check if it exists in local image store.
|
||||
// if not, return pulling error. otherwise log it.
|
||||
|
||||
Reference in New Issue
Block a user