Issue
If the image mentioned in .dunner.yaml
is not present on the system, ImagePull
is not able pull the image according to current implementation.
Workaround
After referring to this thread, it was found that the reader returned by ImagePull
needs to be handled.
Modifying the code in do.go
from line no. L49 to
reader, err := cli.ImagePull(ctx, step.Image, types.ImagePullOptions{})
if err != nil {
panic(err)
}
_, err = stdcopy.StdCopy(os.Stdout, os.Stderr, reader)
if err != nil {
panic(err)
}
produces the following error,
panic: Unrecognized input header: 123
This error is produced by stdcopy.StdCopy
method. However, this method produces no error at L81.
Using io
instead of stdcopy
for output works smoothly.
reader, err := cli.ImagePull(ctx, step.Image, types.ImagePullOptions{})
if err != nil {
panic(err)
}
_, err = io.Copy(os.Stdout, reader)
if err != nil {
panic(err)
}
Further Problem
However the produced output logs every step of download/extract process in separate line, which becomes very untidy. Is there any way to silent the output and simultaneously handle the returned reader by ImagePull
.
Platform Specifications
OS: x86_64 GNU/Linux
Docker:
* Client version: 18.09.0
* Engine version: 18.09.0
Golang version: go1.11.2