# コンテナ内でapt-get updateが失敗する yarnリポジトリに署名がない

**URL:** https://meta.discourse.org/t/apt-get-update-fails-inside-container-yarn-repo-not-signed/253133
**Category:** Bug
**Created:** [2023 年 1 月 27 日午後 5:02 UTC](https://meta.discourse.org/t/apt-get-update-fails-inside-container-yarn-repo-not-signed/253133 "2023-01-27T17:02:41Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2023 年 1 月 27 日午後 5:58 UTC](https://meta.discourse.org/t/apt-get-update-fails-inside-container-yarn-repo-not-signed/253133/5 "2023-01-27T17:58:21Z")

</div>

了解しました。 ~~確認ですが、新しいphpbb3インポートコンテナをビルドする必要があり、それができません。~~ 修正方法は以下の通りです。

こちらをご覧ください。

> <https://github.com/yarnpkg/yarn/issues/7866>
>
> If you see an error like this:
> \`\`\`
> The following signatures were invalid: EXPK…EYSIG 23E7166788B63E1E Yarn Packaging \<yarn@dan.cx\>
> \`\`\`
> 
> Or like this:
> \`\`\`
> W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://dl.yarnpkg.com/debian stable InRelease: The following signatures were invalid: EXPKEYSIG 23E7166788B63E1E Yarn Packaging \<yarn@dan.cx\>
> W: Failed to fetch https://dl.yarnpkg.com/debian/dists/stable/InRelease The following signatures were invalid: EXPKEYSIG 23E7166788B63E1E Yarn Packaging \<yarn@dan.cx\>
> \`\`\`
> It means that you still have an older version of the GPG key used to sign Yarn releases. The expiry date for this key was extended from 2020 to 2021. To get the updated key, run this:
> 
> \`\`\`sh
> curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
> \`\`\`
> 
> This will likely be automated in the future.

しかし、`apt-key` は非推奨であるため、`curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -` を使用することが推奨されています。

コンテナ内で次のように実行すると：

```plaintext
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg -o /usr/share/keyrings/yarn-keyring.asc \
    && sed -i '1s;^deb;deb [signed-by=/usr/share/keyrings/yarn-keyring.asc];' /etc/apt/sources.list.d/yarn.list

```

次のような `apt-get update` を実行できます：

```plaintext
root@monstera-web-only:/# apt-get update
Hit:1 https://deb.nodesource.com/node_18.x bullseye InRelease
Hit:2 http://deb.debian.org/debian bullseye InRelease
Get:3 https://dl.yarnpkg.com/debian stable InRelease [17.1 kB]
Get:4 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Hit:5 http://deb.debian.org/debian bullseye-updates InRelease
Hit:6 http://deb.debian.org/debian bullseye-backports InRelease
Get:7 https://dl.yarnpkg.com/debian stable/main all Packages [10.9 kB]
Get:8 http://deb.debian.org/debian-security bullseye-security/main amd64 Packages [216 kB]
Hit:9 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg InRelease
Get:10 https://dl.yarnpkg.com/debian stable/main amd64 Packages [10.9 kB]
Fetched 286 kB in 0s (849 kB/s)
Reading package lists... Done

```

同様に、`templates/import/phpbb3.template.yml` の `apt-get update` の前に次を追加すると：

```plaintext
          - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg -o /usr/share/keyrings/yarn-keyring.asc && sed -i '1s;^deb;deb [signed-by=/usr/share/keyrings/yarn-keyring.asc];' /etc/apt/sources.list.d/yarn.list

```

新しいコンテナをビルドできるようになります。

---

_[View the full topic](https://meta.discourse.org/t/apt-get-update-fails-inside-container-yarn-repo-not-signed/253133)._
