LoginSignup
6
5

More than 5 years have passed since last update.

Proxy環境下でのDockerbuildをするためにやること

Posted at

Docker Engine 1.9 からです。

Proxy配下にいると、build時にproxyを通らないとapt-getもyumも通りません。
かと言って、これに毎回 ENV http_proxy=XXX ってのを書き続けるのも心が折れます。

下記のようにしておくと、様々な環境下で動いてくれるので平和な気持ちでいられます。

ARG http_proxy
ARG https_proxy

ENV http_proxy=${http_proxy}
ENV https_proxy=${https_proxy}

で、build時に下記のようにコマンドを打ちます

% docker build --rm -t hoge \
  --build-arg http_proxy=${http_proxy} \
  --build-arg https_proxy=${https_proxy} .

きちんとproxyに渡って行きます!

平和!

6
5
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
6
5