在docker-compose build的apt update中发生了一个“…”未签名的错误

為了Rails的產品開發,我使用docker-compose建立本地開發環境並進行工作。
一天,在執行docker-compose build時,突然出現以下錯誤並失敗。
之前幾天都沒有發生失敗的情況,且沒有更改Dockerfile或docker-compose.yml,為什麼會這樣呢?我進行了調查,將記錄留下。

操作

$ docker-compose build

错误内容 (Error content)

redis uses an image, skipping
db uses an image, skipping
phpmyadmin uses an image, skipping
Building web
[+] Building 2.3s (6/18)                                                                                                                                                                                                                    
 => [internal] load build definition from Dockerfile                                                                                                                                                                                   0.0s
 => => transferring dockerfile: 37B                                                                                                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                      0.0s
 => => transferring context: 34B                                                                                                                                                                                                       0.0s
 => [internal] load metadata for docker.io/library/ruby:3.0.4                                                                                                                                                                          1.1s
 => [internal] load build context                                                                                                                                                                                                      0.9s
 => => transferring context: 6.51MB                                                                                                                                                                                                    0.7s
 => CACHED [ 1/14] FROM docker.io/library/ruby:3.0.4@sha256:c715dce1d425977f03fcdb4aedf6e14cc8b554d8e66877488cd1a4e06ce1f20b                                                                                                           0.0s
 => ERROR [ 2/14] RUN apt update -qq && apt install -y curl apt-transport-https wget nodejs default-mysql-client build-essential vim                                                                                                   1.1s
------                                                                                                                                                                                                                                      
 > [ 2/14] RUN apt update -qq && apt install -y curl apt-transport-https wget nodejs default-mysql-client build-essential vim:
#5 0.304 
#5 0.304 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
#5 0.304 
#5 1.024 W: GPG error: http://deb.debian.org/debian bullseye InRelease: At least one invalid signature was encountered.
#5 1.024 E: The repository 'http://deb.debian.org/debian bullseye InRelease' is not signed.
#5 1.024 W: GPG error: http://deb.debian.org/debian-security bullseye-security InRelease: At least one invalid signature was encountered.
#5 1.024 E: The repository 'http://deb.debian.org/debian-security bullseye-security InRelease' is not signed.
#5 1.024 W: GPG error: http://deb.debian.org/debian bullseye-updates InRelease: At least one invalid signature was encountered.
#5 1.024 E: The repository 'http://deb.debian.org/debian bullseye-updates InRelease' is not signed.
------
executor failed running [/bin/sh -c apt update -qq && apt install -y curl apt-transport-https wget nodejs default-mysql-client build-essential vim]: exit code: 100
ERROR: Service 'web' failed to build : Build failed

引起

Mac上的Docker Desktop分配的磁盘镜像大小已经满了。

处理方法

Image from Gyazo

或者,如果没有空间的话,可以通过以下命令删除未使用的Docker对象来释放空间。

使用 prune 命令删除未使用的 Docker 对象的方法。

清理未使用的图像
$ docker image prune

※更详细的命令选项等说明,请参阅这里。

停放着的容器整理整顿。
$ docker container prune

有关命令选项等更详细的说明,请点击此处。

删除未使用的卷
$ docker volume prune

请点击此处获取更详细的指令选项等相关说明。

网络清理(与磁盘容量无关,针对爱洁净的人士)
$ docker network prune

※ 关于命令选项等更详细的说明在这里

巴尔斯(只除了音量,其他全部都是脉冲)。
$ docker system prune
在一次整体删减音量时,需要添加选项。
$ docker system prune --volumes
bannerAds