简体   繁体   中英

Docker: hashicorp/boot2docker fails to download behind corporate proxy

I'm trying to configure a number of docker containers to run from vagrant, however the corporate proxy is preventing the download of boot2docker, the VM that is downloaded when Vagrant is running on an OS that doesn't support containers; the error is an SSL Verification error. My company proxy does MITM content inspection, so it replaces the HTTPS cert with it's own cert.

I've set the http_proxy (etc) environment variables and tried both config.vm.box_download_insecure and config.vm.box_download_ca_cert (with custom cacert.pem that contains the proxy cert).

This config works:

Vagrant.configure(2) do |config|

  #config.vm.box_download_insecure = "true"
  config.vm.box_download_ca_cert = "cacert.pem"
  config.vm.box = "hashicorp/precise64"
  config.vm.provider "virtualbox" do |vb|
    vb.memory = "1024"
    vb.cpus = "2"
  end
end

This does not:

Vagrant.configure(2) do |config|

  #config.vm.box_download_insecure = "true"
  config.vm.box_download_ca_cert = "cacert.pem"
  config.vm.provider "docker" do |d|
    d.build_dir = "../path/to/docker"
    d.has_ssh = true
  end
end

Has anybody got any ideas as to why it wouldn't be working?

Update:

Frederick provided a suitable workaround below, but it highlighted that I'd asked my question too quickly.

One of the features of Vagrant's docker provider is that it will automatically download boot2docker if it is required (eg running on Windows or OSX) when the user calls "vagrant up". So the dev in question doesn't really need to care if he needs the proxy vm or not, it'll just work.

I can instruct those on windows to manually install the box (they will have to install other dependencies like cygwin anyway), but it just makes it easier if the instructions are more uniform.

您是否尝试直接像这样直接添加boot2docker框

vagrant box add --insecure hashicorp/boot2docker 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM