apt-cacher は使用できません

apt-cacher は使用できません

私の意見では、apt-cacher私のパッケージプロキシとしてローカルで使用して 。特に再建するとき私のドッカー画像連続して何度も。apt-cacher私のシステムにインストールされ実行されています。

プロキシアドレスを次のように設定しました。 (は私のホスト名http://melroy-pc:3142です。)melroy-pc私の場合はファイルを作成します/etc/apt/apt.conf.d/02proxy

Acquire::http::proxy "http://melroy-pc:3142";
Acquire::https::proxy "http://melroy-pc:3142";

(httpsなしで定義のみ試しましたが、http::proxy追加も試みましたAPT::Get::AllowUnauthenticated "true";いいえ運が良ければ)

次に、適切なコマンド(apt updateおよびapt install)を実行します。これは現在の質問につながります。

Step 9/41 : RUN apt-get update && apt-get install -y --no-install-recommends     dirmngr gnupg gnupg-l10n     gnupg-utils gpg gpg-agent     gpg-wks-client gpg-wks-server gpgconf     gpgsm libassuan0 libksba8     libldap-2.4-2 libldap-common libnpth0     libreadline8 libsasl2-2 libsasl2-modules     libsasl2-modules-db libsqlite3-0 libssl1.1     lsb-base pinentry-curses readline-common     apt-transport-https ca-certificates curl     software-properties-common apt-utils net-tools
 ---> Running in af278cee1d52
Err:1 http://deb.debian.org/debian bullseye InRelease
  403  Access to cache prohibited [IP: 192.168.2.166 3142]
Err:2 http://security.debian.org/debian-security bullseye-security InRelease
  403  Access to cache prohibited [IP: 192.168.2.166 3142]
Err:3 http://deb.debian.org/debian bullseye-updates InRelease
  403  Access to cache prohibited [IP: 192.168.2.166 3142]
Reading package lists...
E: The repository 'http://deb.debian.org/debian bullseye InRelease' is not signed.
E: Failed to fetch http://deb.debian.org/debian/dists/bullseye/InRelease  403  Access to cache prohibited [IP: 192.168.2.166 3142]
E: Failed to fetch http://security.debian.org/debian-security/dists/bullseye-security/InRelease  403  Access to cache prohibited [IP: 192.168.2.166 3142]
E: The repository 'http://security.debian.org/debian-security bullseye-security InRelease' is not signed.
E: Failed to fetch http://deb.debian.org/debian/dists/bullseye-updates/InRelease  403  Access to cache prohibited [IP: 192.168.2.166 3142]
E: The repository 'http://deb.debian.org/debian bullseye-updates InRelease' is not signed.

重要なヒント:私のパッケージはすべて受け取りました。正常にプロキシを使用しない場合は問題なくインストールされます。

このアプローチは、過去に私が代わりapt-keyに使用したときに効果がありました。gpg使ったときに効果がありました(関連性があるかどうかはわかりません。私の他の質問を参照してください)。

ベストアンサー1

@casが指摘したように、Dockerホストは通常​​、他のローカルIPブロックのプライベートIPアドレスを使用します。そしてデフォルトでは、apt-cacherはallowed_hosts = ''バージョン1.7.0以降のデフォルトとして代わりに使用されます*

私の解決策:allowed_hosts設定のコメントを外し、ファイル*に値を入力します/etc/apt-cacher/apt-cacher.conf

allowed_hosts = *

これにより、すべてのIPアドレス(Docker IPを含む)が許可されます。確信するまた、特定の範囲を指定してください

おすすめ記事