Vagrant和Docker nfs失败:错误的文件描述符

时间:2016-05-11 18:00:14

标签: macos vagrant boot2docker nfs vagrantfile

经过大量审核尝试在Vagrant中使用 rsync 与Docker作为提供程序。 (双向同步) 我继续使用 nfs 在VM boot2docker中同步我的文件

我在vagrant up

之后有这个流浪错误消息
dockerhost: Mounting NFS shared folders...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o 'vers=3,udp' 192.168.50.1:'/Users/myMac/workspace/docker-vagrant/test' /project

Stdout from the command:

Stderr from the command:

mount: RPC: Unable to receive; errno = No route to host
mount: mounting 192.168.50.1:/Users/myMac/workspace/docker-vagrant/test on /project failed: Bad file descriptor

Vagrantfile

Vagrant.configure("2") do |config|
 config.vm.box = "dduportal/boot2docker"
 config.vm.define "dockerhost"
 config.vm.network "forwarded_port", guest: 8000, host: 8000
 config.vm.network "private_network", ip: "192.168.50.4"
 config.vm.synced_folder "../", "/project", type: "nfs"
...

我的mac已经拥有nfs,因为使用nfsd start

启动了服务

在Vagrant文​​档中建议使用rsync,但我没有找到从VM到MAC的rsync方法,反之亦然。

我正在使用

  • Mac Yosemite
  • Vagrant 1.8.1
  • VM dduportal / boot2docker

1 个答案:

答案 0 :(得分:0)

我直接在dduportal / boot2docker项目上发布了我的问题。

如果您将自定义Docker主机放在不同的目录中,这是正确的配置。

config.vm.synced_folder "../", "/vagrant", type: "nfs", mount_options: ["nolock", "vers=3", "udp"], id: "nfs-sync"

参考: https://github.com/dduportal/boot2docker-vagrant-box/issues/48