LoginSignup
3

More than 5 years have passed since last update.

proxy環境下でDocker for Macのpullを通す(問題点ありのワークアラウンド)

Last updated at Posted at 2016-05-09

環境
Mac OS X: 10.11.4
Docker for Mac: 1.11.1-beta10 (build: 6662)

proxy環境下でDocker for Macでpullを実行すると以下のようなエラーが出る

$ docker pull busybox
Using default tag: latest
Pulling repository docker.io/library/busybox
Error while pulling image: Get https://index.docker.io/v1/repositories/library/busybox/images: dial tcp: lookup index.docker.io on 192.168.65.1:53: server misbehaving

フォーラムのこの投稿を参考にDocker for Macの裏側で動いているalpineにプロキシを設定する

1.screenコマンドでaplineにログイン(ユーザ名はroot、パスワードはなし)

$ screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
Welcome to Moby alpha
Kernel 4.4.6-moby on an x86_64 (/dev/ttyS0)

                        ##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
           \______ o           __/
             \    \         __/
              \____\_______/

docker login: root

2. /etc/init.d/docker を編集してhttp_proxy, https_proxyなどを追記する

# vi /etc/init.d/docker

#!/sbin/openrc-run

export http_proxy=http://proxyのURL:PORT/
export https_proxy=http://proxyのURL:PORT/

depend()
{
        after transfused
        before chronyd
}

start()
〜省略〜

3. alpine上でdockerを再起動

# service docker restart

4. Mac側でpullすると成功する

$ docker pull busybox
Using default tag: latest
385e281300cc: Pull complete
a3ed95caeb02: Pull complete
Digest: sha256:4a887a2326ec9e0fa90cce7b4764b0e627b5d6afcb81a3f73c85dc29cea00048
Status: Downloaded newer image for busybox:latest

問題点

Mac側でDocker for Macを再起動するとその度にalpineが初期化されるようで、
/etc/init.d/dockerに追記した設定や、その他の手動で作成したファイルがクリアされてしまう・・・

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
3