😺

docker buildで署名検証エラーが発生する

に公開

概要

debian:12のイメージを使用しdocker buildを実行すると、以下のようなエラーが発生した。

0.182 Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
0.234 Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
0.241 Err:1 http://deb.debian.org/debian bookworm InRelease
0.241   At least one invalid signature was encountered.
0.261 Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
0.266 Err:2 http://deb.debian.org/debian bookworm-updates InRelease
0.266   At least one invalid signature was encountered.
0.286 Err:3 http://deb.debian.org/debian-security bookworm-security InRelease
0.286   At least one invalid signature was encountered.
0.558 Ign:4 http://repo.mongodb.org/apt/debian bookworm/mongodb-org/7.0 InRelease
0.713 Get:5 https://packages.cloud.google.com/apt cloud-sdk InRelease [6361 B]
0.755 Err:5 https://packages.cloud.google.com/apt cloud-sdk InRelease
0.755   At least one invalid signature was encountered.
0.934 Get:6 http://repo.mongodb.org/apt/debian bookworm/mongodb-org/7.0 Release [1991 B]
1.348 Get:7 http://repo.mongodb.org/apt/debian bookworm/mongodb-org/7.0 Release.gpg [866 B]
1.366 Ign:7 http://repo.mongodb.org/apt/debian bookworm/mongodb-org/7.0 Release.gpg
1.369 Reading package lists...
1.374 W: GPG error: http://deb.debian.org/debian bookworm InRelease: At least one invalid signature was encountered.
1.374 E: The repository 'http://deb.debian.org/debian bookworm InRelease' is not signed.
1.374 W: GPG error: http://deb.debian.org/debian bookworm-updates InRelease: At least one invalid signature was encountered.
1.374 E: The repository 'http://deb.debian.org/debian bookworm-updates InRelease' is not signed.
1.374 W: GPG error: http://deb.debian.org/debian-security bookworm-security InRelease: At least one invalid signature was encountered.
1.374 E: The repository 'http://deb.debian.org/debian-security bookworm-security InRelease' is not signed.
1.374 W: GPG error: https://packages.cloud.google.com/apt cloud-sdk InRelease: At least one invalid signature was encountered.
1.374 E: The repository 'https://packages.cloud.google.com/apt cloud-sdk InRelease' is not signed.
1.374 W: GPG error: http://repo.mongodb.org/apt/debian bookworm/mongodb-org/7.0 Release: At least one invalid signature was encountered.
1.374 E: The repository 'http://repo.mongodb.org/apt/debian bookworm/mongodb-org/7.0 Release' is not signed.

apt-get installは2回実行しており、2つ目の実行時に発生。インストール対象のパッケージを一つ一つインストールして確認しても、全てのインストール時に発生した。

ChatGPTに投げてみると署名エラーと返ってきたが、

  • 全てのパッケージインストール時に発生している
  • 1度目のinstall時には発生していない

といったことから別の原因だと考えられた。

debian自体のエラーかと思い検索したが特に引っかからず。

原因

docker 関連の不要ファイルが多すぎた。

以下の記事を参考にdisk limitを緩和したり(60GBから120GBへ変更)、docker image pruneで不要なイメージを削除すると解消。
https://blog.pinkumohikan.com/entry/signature-verification-error-occurs-during-docker-build

dockerのお掃除は定期的にしなければダメ。

GitHubで編集を提案

Discussion