MicrosoftのDev Containerイメージのビルドがyarnpkgのシグネチャエラーで失敗する事象の取り急ぎの対応メモ

updated@2026-01-28

2026/1/28現在、mcr.microsoft.com/vscode/devcontainers/python:1-3.12-bullseyeなどのイメージを使用している場合にapt updateを実行すると、以下のようにyarnpkgのGPG署名エラーが発生してしまっているようです。

 => [internal] load metadata for mcr.microsoft.com/vscode/devcontainers/p  0.2s
 => [context dev_containers_feature_content_source] load .dockerignore     0.0s
 => => transferring dev_containers_feature_content_source: 2B              0.0s
 => CACHED [dev_container_auto_added_stage_label  1/15] FROM mcr.microsof  0.0s
 => CACHED FROM ghcr.io/astral-sh/uv:0.5.31@sha256:7bff3c3776ec467fc14379  0.0s
 => [context dev_containers_feature_content_source] load from client       0.0s
 => => transferring dev_containers_feature_content_source: 32.64kB         0.0s
 => ERROR [dev_container_auto_added_stage_label  2/15] RUN apt update &&   3.0s
------
 > [dev_container_auto_added_stage_label  2/15] RUN apt update:
0.464 
0.464 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
0.464 
0.554 Get:1 http://deb.debian.org/debian bullseye InRelease [75.1 kB]
0.572 Get:2 http://deb.debian.org/debian-security bullseye-security InRelease [27.2 kB]
0.579 Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.0 kB]
0.600 Get:4 https://dl.yarnpkg.com/debian stable InRelease
0.714 Get:5 http://deb.debian.org/debian bullseye/main amd64 Packages [8066 kB]
0.986 Err:4 https://dl.yarnpkg.com/debian stable InRelease
0.986   The following signatures were invalid: EXPKEYSIG 23E7166788B63E1E Yarn Packaging <yarn@dan.cx>
1.262 Get:6 http://deb.debian.org/debian-security bullseye-security/main amd64 Packages [443 kB]
1.279 Get:7 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [18.8 kB]
2.137 Reading package lists...
2.573 W: GPG error: https://dl.yarnpkg.com/debian stable InRelease: The following signatures were invalid: EXPKEYSIG 23E7166788B63E1E Yarn Packaging <yarn@dan.cx>
2.573 E: The repository 'https://dl.yarnpkg.com/debian stable InRelease' is not signed.

適当にググったら以下のIssueがヒットしました。
5日前にOpenされてるやないかい

イメージ側の更新が来るまでの取り急ぎの措置として、
Dockerfileのapt update実行前に以下のようなコマンドを追加すれば回避できました。

RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarn-archive-keyring.gpg

URLやディレクトリのパスは使用しているイメージによって変わるかと思うので、Issueに付いてるコメントを漁って適宜書き換えると良いかと思います

スポンサーリンク