ようへいの日々精進XP

よかろうもん

(小ネタでごめんネ) Docker コンテナで apt-get update が失敗すると思ったら。。。

この記事は

YAMAP エンジニア Advent Calendar 2022 の第九日目の記事です。

qiita.com

経緯

ある日突然。。。Docker コンテナ内で apt-get update が失敗するようになりました。

$ docker run -t -i wordpress:5.9.3 bash
root@cfe7ddf324e7:/var/www/html# apt-get update
Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:2 http://security.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
Err:1 http://deb.debian.org/debian bullseye InRelease
  At least one invalid signature was encountered.
Err:2 http://security.debian.org/debian-security bullseye-security InRelease
  At least one invalid signature was encountered.
Err:3 http://deb.debian.org/debian bullseye-updates InRelease
  At least one invalid signature was encountered.
Reading package lists... Done
W: GPG error: http://deb.debian.org/debian bullseye InRelease: At least one invalid signature was encountered.
E: The repository 'http://deb.debian.org/debian bullseye InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://security.debian.org/debian-security bullseye-security InRelease: At least one invalid signature was encountered.
E: The repository 'http://security.debian.org/debian-security bullseye-security InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://deb.debian.org/debian bullseye-updates InRelease: At least one invalid signature was encountered.
E: The repository 'http://deb.debian.org/debian bullseye-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

更にビルドした WordPress コンテナは、コンテナ自体は起動するものの WordPress が起動しないという状態。

なんで?

灯台下暗し。コンテナのルートパーティション使用率が 100% になっていました。

root@cfe7ddf324e7:/var/www/html# df -h
Filesystem      Size  Used Avail Use% Mounted on
overlay          59G   58G     0 100% /
tmpfs            64M     0   64M   0% /dev
tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
shm              64M     0   64M   0% /dev/shm
/dev/vda1        59G   58G     0 100% /etc/hosts
tmpfs           2.0G     0  2.0G   0% /proc/acpi
tmpfs           2.0G     0  2.0G   0% /sys/firmware

手元のラップトップで動かしている Docker for Mac の Disk image size を拡張するか、コンテナイメージや停止したコンテナの大掃除をするか二択の中で。。。

思い切って

コンテナやイメージの大掃除をしちゃいました。(上図は大掃除した後の状態)

大掃除のおかげで無事に apt-get update も正常に完了するようになり、WordPress も正常に起動するようになりましたとさ。

現場からの報告は以上です!