我正在代理后面的机器上玩 Vagrant 文件。
此刻我遇到一个问题,我认为这与代理服务器有关。
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
docker build --tag=java /vagrant/java
Stdout from the command:
Sending build context to Docker daemon 2.048 kB
Sending build context to Docker daemon
Stderr from the command:
time="2015-03-11T16:14:47Z" level="fatal" msg="Error: 404 page not found"
在 Vagrant 文件中我发现了这一行d.build_image --tag=java /vagrant/java”无法正常工作。我真的无法弄清楚幕后发生了什么。我猜想原因可能是虚拟机之间的代理。
这是 Vagrant 文件:
Vagrant.configure("2") do |config|
config.vm.box = "chef/ubuntu-14.04"
config.vm.synced_folder "../user-registration-application/target", "/target", create: true
config.vm.network "forwarded_port", guest: 8080, host: 8080
config.vm.network "forwarded_port", guest: 8081, host: 8081
config.vm.network "forwarded_port", guest: 9200, host: 9200
if Vagrant.has_plugin?("vagrant-proxyconf")
config.proxy.http = "http://10.1.3.3:3128/"
config.proxy.https = "http://10.1.3.3:3128/"
config.proxy.no_proxy = "localhost,127.0.0.1"
end
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
config.vm.provision "docker" do |d|
d.build_image "--tag=java /vagrant/java"
d.build_image "--tag=tomcat /vagrant/tomcat"
d.build_image "--tag=kibana /vagrant/kibana"
d.build_image "--tag=elasticsearch /vagrant/elasticsearch"
d.build_image "--tag=logstash /vagrant/logstash"
d.build_image "--tag=user-registration /vagrant/user-registration"
d.run "elasticsearch",
args: "-p 9200:9200"
d.run "kibana",
args: "-p 8080:8080"
d.run "logstash",
args: "--link elasticsearch:elasticsearch"
d.run "user-registration",
args: "-p 8081:8080 -v /target:/target --volumes-from logstash"
end
end
有人知道 Docker 尝试与谁建立连接吗?这是通过 ssh 发生的吗?
答案1
好的,这现在真的很辛苦。;-)
我可以在这里找到解决方案https://github.com/tmatilai/vagrant-proxyconf/issues/109。
将 Vagrant 无代理变量修改为:
config.proxy.no_proxy = "localhost,127.0.0.1,/var/run/docker.sock
解决了问题。
答案2
你见过吗更新后,Docker 守护进程回答“404 页面未找到”? 如果你的docker版本是1.5,那么你需要更新你的docker。
- documnet 的 Docker 更改日志:https://github.com/docker/docker/pull/10192/files
- 相关 vagrant-proxyconf 问题#109:https://github.com/tmatilai/vagrant-proxyconf/issues/109