6

I want to debug a failing docker compose build --no-cache (it succeeds with the cache), however due to the log limit, I cannot see the reason for the failure, only the message output clipped, log limit 1MiB reached.

Following the Docker documentation, I created the following /etc/docker/daemon.json:

{
  "features": { "buildkit": true },
  "log-driver": "local",
  "log-opts": 
  {
    "max-size": "100m",
    "max-file": "3"
  }
}

After systemctl docker restart, docker info shows:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.8.2-docker)
  compose: Docker Compose (Docker Inc., 2.6.0)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 20.10.17
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: false
  userxattr: false
 Logging Driver: local
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1.m
 runc version: 
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.18.5-arch1-1
 Operating System: Arch Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 15.41GiB
 Name: konradspc
 ID: 6NFV:RQP7:V6XK:7D6Z:W2LC:LPGR:HQBQ:V55P:BECL:WXPP:YPC5:2QQ2
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Notably, the logging driver is now shown as "local", where before it was "json-file", so it seems to me as if Docker is successfully loading /etc/docker/daemon.json.

However when I execute docker compose build --no-cache again, I still get the message output clipped, log limit 1MiB reached.

How do I get docker compose to not ignore daemon.json or is there any other way to access the full build log?

I am using Docker version 20.10.17, build 100c70180f, Docker Compose version 2.6.0 with BuildKit on Arch Linux with Kernel 5.18.5. BuildKit cannot be deactivated because the build uses --mount=type=cache,target=/root/.m2 to cache Maven dependencies.

1 Answer 1

2

According to this thread, one workaround is to disable buildkit for the build, which will bypass that logging limitation:

DOCKER_BUILDKIT=0 docker compose build --no-cache

Other users have seen success with this method as well. Another suggestion that seem to have worked for several individuals is adding the following environmental variables in /etc/sysconfig/docker:

BUILDKIT_STEP_LOG_MAX_SIZE=10000000
BUILDKIT_STEP_LOG_MAX_SPEED=10000000

Theoretically, according to the source, all limitations can be removed by using the value -1 for each of the variables, but there have been mixed results according to other users.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.