9

我正在尝试更改我的 VagrantFile 以便它使用 NFS 挂载而不是默认的 VirtualBox 共享文件夹。

我收到此错误消息:

vm:
* Shared folders that have NFS enabled do not support owner/group
attributes. Host path: .

这是我的流浪文件:

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 
  config.vm.box = "ktbartholomew/lamp"
  config.vm.network "private_network", type: "dhcp"
  config.vm.synced_folder ".", "/vagrant", type: "nfs"
end

我看不到任何所有者或组正在设置。

请帮忙!谢谢

4

2 回答 2

3

我发现直接映射 uid/gid 可以正常工作。在流浪者方面有点奇怪,因为他们是任意的用户/组,但除此之外它很好。

Vagrant.configure("2") do |config|
  # ...
  config.nfs.map_uid = Process.uid
  config.nfs.map_gid = Process.gid
  config.vm.synced_folder ".",  "/vagrant", id: "vagrant-root", :nfs => true
  config.vm.synced_folder "..", "/var/www", id: "application",  :nfs => true
end
于 2014-08-18T10:59:58.747 回答
2

Vagrant 仅在所有者或组为 true 时才会引发此错误。尝试通过为两个 synced_folder 配置的这两个选项传递 nil 来强制它。

, group: nil, owner: nil

这是代码: https ://github.com/mitchellh/vagrant/blob/8655d212c327d363f8e80185705ff70bb2e97f6b/plugins/kernel_v2/config/vm.rb#L572

于 2014-09-13T18:14:57.453 回答