我有以下Vagranfile。当我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...
[流浪者档案]
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
我遇到了这个问题,这令人困惑。您需要知道的第一件事是导致超时的问题。
如果您使用的是VirtualBox,则可以将其添加到VagrantFile中:
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
vb.gui = true
这将启动VirtualBox窗口,并帮助您了解在VM启动过程中遇到的潜在错误。
就我而言,我尝试了几件事,最终将流浪者超时提高到 600:
config.vm.boot_timeout = 600
你也可以在StackOverflow上阅读这个提要,它描述了同样的问题: 流浪超时