Buildkit: Progress is redirected to output on Travis-CI

Created on 11 Mar 2019  路  6Comments  路  Source: moby/buildkit

I'm trying to build my Docker images on Travis-CI and redirect output back to Docker using these options:

 --exporter docker --exporter-opt name="${image}:${tag}" |  docker load 

But it is failing with message:

Error processing tar file(exit status 1): archive/tar: invalid tar header

I investigated the issue and found out that the stderr output used for progress is mixed with stdout and everything is streamed into Docker.

bug exbeginner

Most helpful comment

The CLI was massively updated in https://github.com/moby/buildkit/pull/807

--output type=docker,name="${image}:${tag}",dest=a.tar can be also written in the legacy form: --exporter docker --exporter-opt name="${image}:${tag}" --exporter-opt output=a.tar.

All 6 comments

Please try mkfifo a.tar; buildctl build --output type=docker,name="${image}:${tag}",dest=a.tar ... & docker load < a.tar & wait

@AkihiroSuda What would be the reason the more hacky version is needed? buildctl should not print any progress output to stdout.

I thought it makes sense to use stdout for --progress=plain, but no strong opinion

Ah, didn't realize it was from the progress value. Yes, I think we should fix it and always put the progress to stderr.

@AkihiroSuda The trick with fifo worked perfectly, thank you! How I missed that dest option exists for output so that you can specify a file?

The CLI was massively updated in https://github.com/moby/buildkit/pull/807

--output type=docker,name="${image}:${tag}",dest=a.tar can be also written in the legacy form: --exporter docker --exporter-opt name="${image}:${tag}" --exporter-opt output=a.tar.

Was this page helpful?
0 / 5 - 0 ratings