"no space left on device" 使用 Jenkins 和 Docker 构建时

"no space left on device" when building with Jenkins and Docker

我们使用 Jenkins 构建 Docker 图像,一切都在上周之前找到,每次我尝试在 Jenkins 中构建图像时它都会失败 "Error response from daemon: Error processing tar file(exit status 1): write /app/node_modules/acorn/dist/acorn_loose.es.js: no space left on device"(它失败的文件可能取决于在项目上)。如果我尝试在服务器中使用 Docker 但在 Jenkins 上失败,图像将会构建。

我尝试删除旧容器和图像等但无济于事。磁盘 space 和 inode 似乎没问题,所以我不确定现在该尝试什么。感谢任何帮助。

"docker info"的结果:

Containers: 55
 Running: 48
 Paused: 0
 Stopped: 7
Images: 59
Server Version: 17.03.2-ce
Storage Driver: overlay
 Backing Filesystem: extfs
 Supports d_type: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 4ab9917febca54791c5f071a9d1f404867857fcc
runc version: 54296cf40ad8143b62dbcaa1d90e520a2136ddfe
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.45-rancher
Operating System: RancherOS v1.1.0
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 19.61 GiB
Name: rancher
ID: Z7Z3:T3NW:N4O3:FKMZ:7KH6:FJ7R:TJ6A:FXLW:KNUL:WMRC:ED74:KHEM
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 dockerhub.companysite.net:5000
 127.0.0.0/8
Live Restore Enabled: false

"df -h"的结果:

Filesystem      Size  Used Avail Use% Mounted on
overlay          47G   27G   18G  60% /
tmpfs           9.9G     0  9.9G   0% /dev
tmpfs           9.9G     0  9.9G   0% /sys/fs/cgroup
/dev/sda1        47G   27G   18G  60% /.r
shm              64M     0   64M   0% /dev/shm
tmpfs           9.9G     0  9.9G   0% /sys/firmware

"df -ih"的结果:

Filesystem     Inodes IUsed IFree IUse% Mounted on
overlay           13M  2.8M  9.8M   22% /
tmpfs            2.5M    16  2.5M    1% /dev
tmpfs            2.5M    15  2.5M    1% /sys/fs/cgroup
/dev/sda1         13M  2.8M  9.8M   22% /.r
shm              2.5M     1  2.5M    1% /dev/shm
tmpfs            2.5M     1  2.5M    1% /sys/firmware

您可能遗留了一堆导致问题的旧悬挂图像,请尝试:

docker volume rm $(docker volume ls -qf dangling=true)

(这确实会删除内容,因此您可能需要在执行此操作之前检查是否有任何内容要保留在任何悬空卷中)

您应该清理旧容器、图像和卷。您可以使用 prune 仅通过一个命令将其删除:

docker system prune

删除所有未使用的容器、网络、图像(悬空和未引用的)以及可选的卷。

输出:

WARNING! This will remove:
        - all stopped containers
        - all networks not used by at least one container
        - all dangling images
        - all build cache
Are you sure you want to continue? [y/N] y