Rails 手欠!又一次运行了 vagrant init

shangrenzhidao · 2013年11月13日 · 最后由 shangrenzhidao 回复于 2013年11月13日 · 3080 次阅读

由运行了一次 vagrant init,发现 vagrant up 时又新建了个虚拟机,而不是那个默认的了,请问该怎么办?

每个目录中只能 vagrant init 一次 , 不存在多次 init .

#1 楼 @song940 为什么会有两个?一个是关闭的。

这是两个不同的虚拟机吧~

#3 楼 @song940 对,我现在想执行 vagrant up 把之前的虚拟机启动,但是偏偏却起了这个新的

那要进入 之前 的虚拟机目录

#5 楼 @song940 应该和 vagrant 相关的目录吧

恩 , 就是你之前做 vagrant init 的目录

#7 楼 @song940 难道把之前的覆盖掉了?

#8 楼 @shangrenzhidao 不会的 , 如果你在一个已经创建 (init) 的目录中再次执行时会提示你已经存在了 , 想继续的话,需要删除 Vagrantfile 文件才行

我猜你可能忘记在那个目录中创建了 ...

#9 楼 @song940 是不是我为 vagrant 配置环境变量的那个目录 C:\HashiCorp\Vagrant\bin

#10 楼 @shangrenzhidao 是你当时的工作目录 , 创建一个虚拟机

localhost:vm lsong$ pwd
/Users/Lsong/Documents/vm
localhost:vm lsong$ vagrant box list
precise32 (virtualbox)
localhost:vm lsong$ vagrant init precise32
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
localhost:vm lsong$

那么你下次想要运行他的话 , 就必须再次回到这个目录:

localhost:~ lsong$ cd /Users/Lsong/Documents/vm
localhost:vm lsong$ vagrant up

#10 楼 @shangrenzhidao 它还是回去新建一个,如果我要是去直接在 vbx 启动,那么就不会读取那个 vagrantfile,所以那些配置都不起作用了

需要 登录 后方可回复, 如果你还没有账号请 注册新账号