如何在第一次运行时运行Vagrant配置? [英] How to run Vagrant provisioning on the first run?
本文介绍了如何在第一次运行时运行Vagrant配置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个非常简单的Vagrant文件,像这样:
I have a very simple Vagrant file like this:
config.vm.box = "precise32"
config.vm.synced_folder "./src", "/vagrant/src/"
config.vm.network "forwarded_port", guest: 8080, host: 8080
config.vm.provision :shell, :path => "install.sh"
当我做 vagrant up
install.sh
未被调用,但我必须重新加载 - provision
。如何在第一次运行 install.sh
?
When I do vagrant up
the install.sh
is not called, but I have to reload with --provision
. How do I run install.sh
on the first up?
推荐答案
从Vagrant 1.3开始,只有在第一次启动时,当机器被创建时,配置才会自动运行。
From Vagrant 1.3 onwards, provisioning runs automatically only at the very first boot, when the machine gets created.
如果你需要在随后的 reload
或 up
,您必须明确调用它:
If you need to run it on the subsequent reload
or up
, you have to call it explicitly:
vagrant up --provision
这篇关于如何在第一次运行时运行Vagrant配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文