boot2docker
を起動して、/var/lib/boot2docker/profile
に以下を記述
export no_proxy=localhost,127.0.0.1,.example.com
export http_proxy=http://username:password@proxy.example.com:8080
export https_proxy=$http_proxy
vi
叩くのが面倒な場合は、以下のコマンドをコピペでOK
sudo tee /var/lib/boot2docker/profile <<'EOF' >/dev/null
export no_proxy=localhost,127.0.0.1,.example.com
export http_proxy=http://username:password@proxy.example.com:8080
export https_proxy=$http_proxy
EOF
sudo /etc/init.d/docker restart
で以降、docker
コマンドでproxyをパスできる。
docker@boot2docker:~$ docker pull learn/tutorial
Pulling repository learn/tutorial
8dbd9e392a96: Download complete
Status: Downloaded newer image for learn/tutorial:latest
docker@boot2docker:~$ docker run learn/tutorial echo "Hello world"
Hello world
まあ、dockerでとってきたOSの中でもproxy設定しないといけないのですが・・
docker@boot2docker:~$ docker run -e http_proxy learn/tutorial apt-get install -y ping