@peccul is peccu

(love peccu '(emacs lisp cat outdoor bicycle mac linux coffee))

docker build中にaptがこける

tl;dr

ホストマシンのdockerを更新すれば良かった。

まさかホスト側がここに影響するとは、と言う気づき

背景とか

Dockerfileにいつも通りapt-get updateとか書いても失敗する。

NO_PUBLICKEYとか、gpgの鍵が一致しないとか出てくる

だいたいこんな感じのログがでてくる

Get:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [99.8 kB] Err:1 http://archive.ubuntu.com/ubuntu jammy InRelease   
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C 
W: http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg are ignored as the file is not readable by user '_apt' executing apt-key.

docker runなら無視するオプション(--security-opt seccomp:unconfined)をつけられるがbuild時は使えず。

ホスト側でdockerパッケージを更新したら解決した

参考

askubuntu.com

askubuntu.com