在本地连接docker与vagrant配置的docker

时间:2015-11-10 19:08:32

标签: docker vagrant virtualbox

我试图让docker在vagrant下运行但没有使用完整的vagrant解决方案 - 我只想使用vagrant来创建vm并在其上安装docker,但是我想我已经有了为环境做更多的事情。

我在这种环境下运行

Windows 8
Vagrant 1.7.4
Virtualbox 5.0.6
Cisco Anyconnect - I've read this can cause issues

这是我的流浪剧

Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/trusty64"
  config.vm.hostname = "docker-host"
  config.vm.network :forwarded_port, guest: 2375, host: 2375

  config.vm.provider "virtualbox" do |vb|
    vb.name = "docker-host"
    vb.memory = "4096"
    vb.cpus = 2
  end

  config.vm.provision "docker"
end

运行vagrant up效果很好,当我进入ssh时,我可以运行docker,一切似乎都很好 - 或者至少是码头打印出来。

回到我的本地机器上我有一个docker文件然后我尝试运行失败的docker build .并获得以下输出

An error occurred trying to connect: Post http://localhost:2375/v1.21/build?buildargs=%7B%7D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=dockerfile&memory=0&memswap=0&rm=1&t=&ulimits=null: net/http: 
transport closed before response was received

如果我尝试docker run --name some-redis -d redis,我会收到以下错误

An error occurred trying to connect: Post http://localhost:2375/v1.21/containers/create?name=some-redis: WSARecv tcp 127.0.0.1:50949: 
An existing connection was forcibly closed by the remote host.

我想知道是否有人可以帮助告诉我这里的问题是什么以及如何让我的本地安装的docker与我在虚拟机和流浪者下的配置虚拟机交谈。

我已经尝试了telnet localhost 2375这似乎没问题

0 个答案:

没有答案