gpt4 book ai didi

vagrant - 在 Vagrant 文件中添加故障安全箱 URL

转载 作者:行者123 更新时间:2023-12-01 00:48:01 24 4
gpt4 key购买 nike

我在 Vagrant 文件中添加了本地框链接,如下所示

config.vm.box = "ubuntu1404"
config.vm.box_url = "http://localserver/ubuntu_trusty64.box"

我的本地服务器可能无法一直访问。我需要为同一个盒子添加另一个盒子 URL,它应该可以从任何地方访问,作为故障安全。如何添加另一个框 url ?

最佳答案

How can I add another box url ?



来自 vagrant documentation

config.vm.box_url - The URL that the configured box can be found at. If config.vm.box is a shorthand to a box in HashiCorp's Atlas then this value doesn't need to be specified. Otherwise, it should point to the proper place where the box can be found if it isn't installed.

This can also be an array of multiple URLs. The URLs will be tried in order. Note that any client certificates, insecure download settings, and so on will apply to all URLs in this list.

The URLs can also be local files by using the file:// scheme. For example: "file:///tmp/test.box".



所以你可以有
config.vm.box_url = ["http://localserver/ubuntu_trusty64.box", "http://anotherserver/ubuntu_trusty64.box", "file://somelocationtobox"]

补充一点:这在您第一次运行时很重要 vagrant up有了这个盒子,Vagrant 将下载并安装这个盒子(它将存储在 ~/.vagrant.d/boxes 目录下)。
一旦下载完成,在很多情况下,即使你已经破坏了虚拟机,Vagrant 也不会重新下载盒子;您可以阅读 config.vm.box_check_update对于 Vagrant 会尝试重新下载的情况

关于vagrant - 在 Vagrant 文件中添加故障安全箱 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33014520/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com