8
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

apt-get のプロキシ設定は小文字!!!!!

Posted at

プロキシ環境下で Docker イメージをビルドしたいことがあったので、ARG でプロキシの情報を設定できるようにしてビルドした。

FROM debian

# プロキシ環境下でビルドする場合に指定する
ARG HTTP_PROXY
ARG HTTPS_PROXY

RUN apt-get update \
 && apt-get install -y ... \
 && rm -rf /var/lib/apt/lists/*
$ docker build --build-arg HTTP_PROXY=... --build-arg HTTPS_PROXY=... .
(略)
Err:1 http://deb.debian.org/debian buster InRelease
  Cannot initiate the connection to prod.debian.map.fastly.net:80 (2a04:4e42:1a::204). - connect (101: Network is unreachable) Could not connect to prod.debian.map.fastly.net:80 (151.101.108.204), connection timed out
  Cannot initiate the connection to deb.debian.org:80 (2a04:4e42:1a::645). - connect (101: Network is unreachable) Could not connect to deb.debian.org:80 (151.101.110.133), connection timed out

は?
プロキシ通せてないやんけ。

なぜこれでうまくいかないのか半日頭を悩ませて判明した正解がこちら。

FROM debian

# プロキシ環境下でビルドする場合に指定する
ARG http_proxy
ARG https_proxy

RUN apt-get update \
 && apt-get install -y ... \
 && rm -rf /var/lib/apt/lists/*
$ docker build --build-arg http_proxy=... --build-arg https_proxy=... .

「環境変数は大文字で指定するもの」「環境変数が Case Sensitive なわけがない」という思い込みが敗因です・・・。

各位プロキシ環境下で apt-get を使う際は気をつけましょう。

8
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?