46

In the output when building, I am getting this message:

[output clipped, log limit 1MiB reached]

from the command

docker build --progress plain .

The current workaround I have is to pipe larger sections of the RUN command in the dockerfile to /dev/null i.e.

RUN \
 echo "**** install packages ****" && \
 apt-get update && \
 apt-get install -y libcairo2-dev libjpeg-turbo8-dev libpng-dev libtool-bin libossp-uuid-dev wget maven default-jdk > /dev/null
alphabet5
  • 1,043
  • 1
  • 11
  • 15
  • You can set a bigger logsize with `--driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=10485760` (i.e 10MiB) – Holger Jan 21 '21 at 00:07
  • could also use quite flag `-qq`, combining `-yqq` – Lawrence Cherone Jan 21 '21 at 00:08
  • To add a little clarity, I'm looking to show the log output to see where the build is failing. -qq or sending to /dev/null works just fine, but I can't see the output I'm looking for when troubleshooting. `--driver-opt` isn't an available flag. ``` docker build --driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=10485760 . unknown flag: --driver-opt See 'docker build --help'. ``` I'm assuming that the --driver-opt flag was taken from buildx, but that doesn't seem to be an option for buildx unless you enable experimental mode. -- testing experimental mode with buildx now. – alphabet5 Jan 22 '21 at 01:39
  • 3
    I was able to get around this issue by creating a builder with `docker buildx create --driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=50000000` and then using the builder with `docker buildx build`, but have not been able to fix the issue when using the default builder and `docker build`. – Luke DeLuccia Jan 22 '21 at 23:41

7 Answers7

27

With the key link provided by @Luke Deluccia, this is what worked for me.

docker buildx create --use --name larger_log --driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=50000000
docker buildx build --progress plain .

This creates a buildx instance, and sets buildx to use the instance when building. This did not clip the logs during the build process.

alphabet5
  • 1,043
  • 1
  • 11
  • 15
  • 3
    Glad this worked for you as well. The only problem is that it does not use the default builder context, which many may want. If I find a solution for that, I'll post it here. – Luke DeLuccia Jan 23 '21 at 14:35
  • 1
    I get: `error: failed to solve: rpc error: code = Unknown desc = failed to read dockerfile: open /tmp/buildkit-mount113931619/Dockerfile: no such file or directory` – StressedBoi69420 Oct 04 '21 at 09:55
8

The other solution is for docker buildx, but some might want a fix for docker build with DOCKER_BUILDKIT=1. The following works for me on ubuntu18.04 and docker version 5:20.10.3~3-0~ubuntu-bionic.

# cat /etc/systemd/system/docker.service.d/env.conf 
[Service]
Environment="BUILDKIT_STEP_LOG_MAX_SIZE=1073741824" # you might want to tweak this
Environment="BUILDKIT_STEP_LOG_MAX_SPEED=10240000"

Then:

systemctl daemon-reload
systemctl restart docker.service
Alexander Sergeyev
  • 922
  • 10
  • 19
8

Was on WSL2 docker. The buildx solution somehow didn't work.

But disabling buildkit and piping the output into a file worked for me

So doing this in a bash shell worked for me:

export DOCKER_BUILDKIT=0
docker build --progress plain ./ > logoutput.txt 
PeterT
  • 7,981
  • 1
  • 26
  • 34
2

Windows 11, Docker Desktop, Docker version 20.10.17.

To turn off BUILDKIT, in the Docker Desktop settings, under "Docker Engine" on the left side, if there's a json block like:

  "features": {
    "buildkit": true
  }

change it to false. If the features block isn't there, it should be under the root {, add it with "buildkit": false.

chad
  • 2,888
  • 1
  • 17
  • 15
1

This answer to complete @AlexanderSergeyev answer's.

This was not working for me on Ubuntu 20.04 because /etc/systemd/system/docker.service.d folder does not exists.

Also, my Docker version is

Docker version 20.10.6, build 370c289

I have to do this instead:

sudo vim /etc/systemd/system/multi-user.target.wants/docker.service

Then under the [Service] tag, put those lines:

Environment="BUILDKIT_STEP_LOG_MAX_SIZE=1073741824"
Environment="BUILDKIT_STEP_LOG_MAX_SPEED=10240000"

And then restart docker daemon:

systemctl daemon-reload
systemctl restart docker.service
Ankhas
  • 13
  • 6
1

for windows:

in cmd run the command:

set DOCKER_BUILDKIT=0

and restart docker desktop

Khaled Ahmed Sobhy
  • 353
  • 2
  • 5
  • 16
0

According to the source it's possible to completely eliminate any limitations using -1 value for both variables:

$ docker buildx create --bootstrap --use --name buildkit \
    --driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=-1 \
    --driver-opt env.BUILDKIT_STEP_LOG_MAX_SPEED=-1
$ docker buildx build --progress plain .
reddot
  • 764
  • 7
  • 15