ラベル proxy の投稿を表示しています。 すべての投稿を表示
ラベル proxy の投稿を表示しています。 すべての投稿を表示

2014年9月29日月曜日

vagrant-proxyconf(1.4.0) supports docker (en)

Hello, proxy fans in the world,

Finally,vagrant-proxyconfdocker has been released!(version 1.4.0).So, you can run docker easily behind a corporate proxy.

docker

You can use vagrant-proxy docker support for docker hosts on ubuntu, RHEL(6,7), CoreOS, boot2docker and so on.

It is easy to use. Install vagrant-proxyconf, then add your proxy configuration to Vagrantfile. If you already use vagrant-proxyconf, you don't need extra configuration for vagrant-proxy docker support.

vagrant-proxyconf installation

Install vagrant-proxyconf

$ vagrant plugin install vagrant-proxyconf
Installing the 'vagrant-proxyconf' plugin. This can take a few minutes...
Installed the plugin 'vagrant-proxyconf (1.4.0)'!
$ 

If you can't install vagrant plugin because of proxy server. Try the followings.

$ http_proxy=http://myproxy:3128/ vagrant plugin install vagrant-proxyconf
Installing the 'vagrant-proxyconf' plugin. This can take a few minutes...
Installed the plugin 'vagrant-proxyconf (1.4.0)'!
$ 

Vagrantfile

Add configuration.

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  if Vagrant.has_plugin?("vagrant-proxyconf")
    config.proxy.http     = "http://myproxy:3128/"
    config.proxy.no_proxy = "localhost,127.0.0.1,.example.com"
  end
  # ... other stuff
end

Running docker

After vagrant up, try to run docker.

vagrant@vagrant-ubuntu-trusty-64:~$ sudo docker.io pull -t 14.04 ubuntu 
Pulling repository ubuntu
ad892dd21d60: Download complete 
vagrant@vagrant-ubuntu-trusty-64:~$ 

If you set http_proxy, it will affect for https communication for docker. You can use private repositories in your intranet, because you can set no_proxy.
docker/registry/registry.go
docker/registry/auth.go
The Go Programming Language Source file src/pkg/net/http/transport.go

Happy proxy life!!

Docker logo and marks usage

vagrant-proxyconf(1.4.0) supports docker

全国のproxy愛好家みなさん、こんにちは。

ついに、vagrantを使う上で欠かすことのできないvagrant-proxyconfdockerサポートが加わりました(version 1.4.0)。これでproxyの内側でも気軽にvagrant上でdockerが使えるようになりました。

docker

対応している主なゲスト(dockerのホスト)としては、ubuntu, RHEL(6,7), CoreOS, boot2dockerなどです。

使い方は簡単です。vagrant-proxyconfをインストールし、Vagrantfileに以下のようにproxyの設定をして起動するだけです。(いまvagrant-proxyconfを利用しているひとはpluginをupdateすればそのまま使えます。)

vagrant-proxyconf のinstall

vagrant-proxyconfをインストールします。

$ vagrant plugin install vagrant-proxyconf
Installing the 'vagrant-proxyconf' plugin. This can take a few minutes...
Installed the plugin 'vagrant-proxyconf (1.4.0)'!
$ 

ここでproxyが理由でインストールできない場合は。。こんな感じですね。

$ http_proxy=http://myproxy:3128/ vagrant plugin install vagrant-proxyconf
Installing the 'vagrant-proxyconf' plugin. This can take a few minutes...
Installed the plugin 'vagrant-proxyconf (1.4.0)'!
$ 

Vagrantfile

こんな感じでproxyの設定を書いてください。

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  if Vagrant.has_plugin?("vagrant-proxyconf")
    config.proxy.http     = "http://myproxy:3128/"
    config.proxy.no_proxy = "localhost,127.0.0.1,.example.com"
  end
  # ... other stuff
end

dockerを使う

vagrant upでVagrantを起動したら、dockerを使ってみてください。

vagrant@vagrant-ubuntu-trusty-64:~$ sudo docker.io pull -t 14.04 ubuntu 
Pulling repository ubuntu
ad892dd21d60: Download complete 
vagrant@vagrant-ubuntu-trusty-64:~$ 

http_proxyを設定すればhttpsの通信もそれを使うようです。また、no_proxyも使えると思いますので、プライベートのレポジトリがあっても大丈夫ですね。
docker/registry/registry.go
docker/registry/auth.go
The Go Programming Language Source file src/pkg/net/http/transport.go

Happy proxy life!!

Docker logo and marks usage