我想调试失败docker compose build --no-cache
(它在缓存中成功),但是由于日志限制,我看不到失败的原因,只能看到消息output clipped, log limit 1MiB reached
。
根据 Docker 文档,我创建了以下内容/etc/docker/daemon.json
:
{
"features": { "buildkit": true },
"log-driver": "local",
"log-opts":
{
"max-size": "100m",
"max-file": "3"
}
}
之后systemctl docker restart
,docker info
显示:
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
值得注意的是,日志记录驱动程序现在显示为“本地”,而之前是“json-file”,所以在我看来,Docker 似乎已成功加载/etc/docker/daemon.json
.
然而,当我docker compose build --no-cache
再次执行时,我仍然收到消息output clipped, log limit 1MiB reached
。
我如何才能docker compose
不忽略daemon.json
或者是否有其他方法来访问完整的构建日志?
我在内核为 5.18.5 的 Arch Linux 上使用 Docker 版本 20.10.17、构建版本 100c70180f、Docker Compose 版本 2.6.0 和 BuildKit。 BuildKit 无法停用,因为构建用于--mount=type=cache,target=/root/.m2
缓存 Maven 依赖项。