Is there a way to increase the log size in docker when building a container?

Viewed 15812

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
5 Answers

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.

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 

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

for windows:

in cmd run the command:

set DOCKER_BUILDKIT=0

and restart docker desktop

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
Related