vagrant 中的默认共享文件夹不可见 [英] Default shared folder in vagrant not visible

查看:29
本文介绍了vagrant 中的默认共享文件夹不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Vagrant 中同步文件夹时遇到问题.我的配置非常简单:

I have a problem with synced folder in Vagrant. My config is really simple:

Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/xenial64"
  config.vm.network :forwarded_port, guest: 80, host: 8080
  config.vm.synced_folder ".", "/vagrant"
end

Vagrant 通常在启动时自动创建 /vagrant 文件夹 - 这次没有发生,所以我手动完成了.但是当我在我的主机系统中创建一个文件时 - 它在来宾中不可见.任何想法为什么?

Vagrant usually creates /vagrant folder automatically on start - this time it did not happen so I've done it manually. But when I create a file in my host system - it's not visible in guest. Any ideas why?

我已经成功地创建了一个类似的配置:

I've succesfully created a similar configuration with:

config.vm.box = "hashicorp/precise64"

但它有点过时,我想使用 Ubuntu 16.04.

but it's a little bit outdated and I want to use Ubuntu 16.04.

是我的配置、vagrant box 还是其他问题?

Is it a problem with my config, vagrant box, or something else?

推荐答案

您可以尝试:确保您拥有最新版本的 Vagrant 和 VB.重新启动您的计算机(我知道,但有时在这些情况下确实有帮助).在新目录中重试(或者 vagrant destroy 如果你想重新开始并且不需要任何旧内容),即确保旧的 .vagrant 目录是没有.

You could try: Make sure you have the latest version of Vagrant and VB. Restart your computer (I know, but it sometimes does help in these cases). Try again in a new directory (or vagrant destroy if you want to start fresh and don't need any old content), i.e., make sure the old .vagrant directory isn't there.

vagrant upvagrant reload 并再次检查.

假设您使用的是 VirtualBox,请确保您没有任何Guest Additions"问题.你可以试试 https://github.com/dotless-de/vagrant-vbguest

Assuming you are using VirtualBox, make sure you don't have any "Guest Additions" issues. You could try https://github.com/dotless-de/vagrant-vbguest

如果它仍然不起作用,请再次检查 --debug 输出,如@frédéric-henri 所述——查找所有提及您的共享名称的内容.此外,/vagrant"并不总是默认值,它取决于框.有时它是/vagrant_data"或其他,但如果您在配置中指定/vagrant" - 应该可以工作.

If it still doesn't work, check the --debug output again as @frédéric-henri mentioned -- look for all mentions of your share name. Also "/vagrant" isn't always the default, it depends on the box. Sometimes it's "/vagrant_data" or others, but if you specify "/vagrant" in the config -- that should work.

这篇关于vagrant 中的默认共享文件夹不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆