'How to capture output from docker build to a file?
I am using docker buildkit to build an image, which produces a lot of output from the command in the docker file. Something is going wrong in the build, and there is a lot of text to scroll through on the terminal. I would like to capture it to a file, where I can search it with my text editor. However, it appears that docker writes the output directly to the terminal, not going through stdout or stderr.
That is:
$ docker build . <various args> 2>&1 > build.log
still produces output to the terminal, and build.log is empty.
I found a page suggesting --progress=plain, but that only appears to affect what is output, not where it is output.
$ docker --version
Docker version 20.10.12, build e91ed57
Solution 1:[1]
This just worked for me :
docker build -t nice-image . > bla.log
using Docker version 20.10.7, build v20.10.7 and zsh shell.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Chai |
