1
0

More than 1 year has passed since last update.

docker-compose build の apt update で The repository '.....' is not signed エラーが発生する

Last updated at Posted at 2022-07-13

Railsのプロダクト開発用に、docker-composeを使ってローカル開発環境を構築して作業をしています。
ある日、docker-compose buildを行ったら突然下記のエラーを出して失敗するようになりました。
この数日前までは失敗していなかったし、Dockerfileにもdocker-compose.ymlにも何も手を加えていなかったのになぜかな?と思いつつ調査したので記録を残します。

操作

$ docker-compose build

エラー内容

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に割り当てているDisk image size が満タンになっていたこと。

解決方法

Docker Desktopの設定画面からDisk image sizeを増やす。
Image from Gyazo

または、その余裕がない場合は下記コマンドで未使用のDockerオブジェクトを削除するなりして空きを増やす。

pruneコマンドを使って使用していないDockerオブジェクトの削除を行う方法

使っていないイメージをクリーンアップする
$ docker image prune

※コマンドのオプションなど、もっと細かい説明はこちら

停止しているコンテナのお片付け
$ docker container prune

※コマンドのオプションなど、もっと細かい説明はこちら

未使用のボリュームの削除
$ docker volume prune

※コマンドのオプションなど、もっと細かい説明はこちら

ネットワークのお掃除(※ディスク容量には関係ないです。綺麗好きの方向け)
$ docker network prune

※コマンドのオプションなど、もっと細かい説明はこちら

バルス(volume以外全てをpulne)
$ docker system prune
volumeもまとめてぶった斬る時はオプションをつける
$ docker system prune --volumes
1
0
0

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
1
0