我有以下Vagran文件。当我vagrant up
时,我收到以下错误。 但是,如果我切换为使用config.vm.network "public_network"
,一切正常。
但我仍然想使用config.vm.network "private_network"
,因此我可以为开发分配固定的IP地址。
[错误]
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection aborted. Retrying...
default: Warning: Connection aborted. Retrying...
[Vagrantfile]
Vagrant.configure("2") do |config|
config.vm.box = "pef"
config.vm.network "private_network", ip: "192.168.33.12"
#config.vm.network "public_network"
config.vm.synced_folder "C:/Users/user1/myprj", "/home/vagrant"
config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
vb.gui = true
# Customize the amount of memory on the VM:
vb.memory = "1024"
# For host-only adapter
vb.customize ["modifyvm", :id, "--uartmode1", "disconnected" ]
vb.customize ["modifyvm", :id, "--nictype1", "Am79C973"]
vb.customize ["modifyvm", :id, "--nictype2", "Am79C973"]
end
end
答案 0 :(得分:0)
我有这个令人困惑的问题。您需要知道的第一件事是导致超时的问题。
如果您正在使用VirtualBox,可以将其添加到您的VagrantFile:
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
vb.gui = true
这将启动VirtualBox窗口并帮助您了解在VM启动过程中可能出现的错误。
在我的情况下,我尝试了几件事,最后将Vagrant的时间提高到600:
config.vm.boot_timeout = 600
您还可以在StackOverflow上阅读此Feed,它描述了同样的问题: Vagrant up timeout