LoginSignup
58
21

More than 3 years have passed since last update.

docker build の apt-get update で The repository ... is not signed エラー

Last updated at Posted at 2020-11-02

何回か遭遇する度に、原因を忘れて無駄に時間を浪費してしまっていたので、覚えておくためにもメモしておきます。

事象

Docker for Macで Ubuntu 20.04 のイメージをbuildしようとして、Dockerfileの中でお決まりのapt-get updateをしたところ、以下のような The repository ... is not signed. エラーが発生することがあります。

Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [107 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Err:1 http://security.ubuntu.com/ubuntu focal-security InRelease
  At least one invalid signature was encountered.
Err:2 http://archive.ubuntu.com/ubuntu focal InRelease
  At least one invalid signature was encountered.
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [111 kB]
Err:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease
  At least one invalid signature was encountered.
Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease [98.3 kB]
Err:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
  At least one invalid signature was encountered.
Reading package lists...
W: GPG error: http://security.ubuntu.com/ubuntu focal-security InRelease: At least one invalid signature was encountered.
E: The repository 'http://security.ubuntu.com/ubuntu focal-security InRelease' is not signed.
W: GPG error: http://archive.ubuntu.com/ubuntu focal InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu focal InRelease' is not signed.
W: GPG error: http://archive.ubuntu.com/ubuntu focal-updates InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu focal-updates InRelease' is not signed.
W: GPG error: http://archive.ubuntu.com/ubuntu focal-backports InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu focal-backports InRelease' is not signed.

メッセージを見て「signatureの問題か?」と思い調べるものの、「いや、Ubuntuのバージョンが前のだったら分かるけど、イメージタグは latest だし起きるのはおかしいよな…」などと毎回時間を浪費していました…

原因

自分のケースの結論から言うと、Dockerのディスクイメージサイズに対して、ルートパーティションの使用量が100%になっていたことが原因でした。

毎回気付くたびに、脱力してしまう…

root@c761181b1d64:/# df -h
Filesystem      Size  Used Avail Use% Mounted on
overlay          30G   28G     0 100% /
...

Docker for Mac の Disk image size を大きくしてあげることで回避可能ですが、増やしてあげる余裕の無いマシンだったこともあり…

未使用の全イメージを削除するdocker image pruneと、停止中の全コンテナを削除するdocker container pruneで容量を空けてあげることで無事回避しました。

ディスクに余裕の無いマシンを使い続ける限り、また御目にかかりそうなエラー。次に遭遇したらスムーズに解決してやる…

参考リンク

Repository is not signed in docker build | stack overflow

58
21
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
58
21