流浪汉提供而不是寻找/流浪者?

时间:2016-06-05 01:34:41

标签: vagrant vagrant-provision

我正在尝试使用Vagrant和虚拟机框来配置虚拟机进行开发,而我无法访问我希望将基本配置文件复制到其位置的/ vagrant文​​件夹。

BTW主机操作系统是MacOS X.

我的目录结构是:

provision/
   install.sh
   config/
      nginx/mydomain
Vagrantfile

Vagrantfile的内容如下:

require 'yaml'
myproject_version = "0.22.1"

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.box = "ubuntu/xenial64"

  config.vm.synced_folder ".", "/vagrant", create: true, group: "ubuntu", owner: "ubuntu"

  config.vm.provider :virtualbox do |vb, override|
    vb.name = 'myprojectserver-dev-standalone'

    # please customize hostname and private ip configuration if you needed.
    override.vm.hostname = "myhost"

    # frontend-webui
    override.vm.network :forwarded_port, guest: 5050, host: 5050
    # admin-webui
    override.vm.network :forwarded_port, guest: 8080, host: 8080
    # services
    override.vm.network :forwarded_port, guest: 8081, host: 8081

    override.vm.provision :shell do |s|
      s.path = "provision/install.sh"
      s.args = "/home/ubuntu ubuntu"
    end
  end

end

在我的剧本中,我尝试:

ls -l /vagrant/
cp /vagrant/provision/config/nginx/mydomain

问题是/vagrant目录不存在。我尝试手动创建它然后重新运行提供过程,但没有变化。

任何人都可以提出我可能做错的事吗?

1 个答案:

答案 0 :(得分:0)

事实证明,当盒子出现时,由于配置问题,配置问题似乎导致了引导程序没有完全完成。#config; vm.provider'部分。这意味着流浪汉从未发生过。

在解决这些问题时,我遇到了以下形式的失败:

<div id="container">
  <div class="box1"></div><span> </span>
  <div class="box2"></div><span> </span>
  <div class="box3"></div><span> </span>
  <div class="box4"></div>
</div>

阅读issue report,解决方法似乎是安装vagrant-vbguest插件:

Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

mount -t vboxsf -o uid=`id -u ubuntu`,gid=`getent group ubuntu | cut -d: -f3` vagrant /vagrant
mount -t vboxsf -o uid=`id -u ubuntu`,gid=`id -g ubuntu` vagrant /vagrant

此时我可以完成配置。