【发布时间】:2015-08-19 02:02:21
【问题描述】:
更新:我已经卸载了 Vagrant 和 Docker,并将接受任何有助于我重新安装它们的答案:
- 我可以在不依赖 Docker 的情况下运行 Vagrant;和
- 我可以在不依赖 Vagrant 的情况下运行 Docker;和
- 我可以运行 Vagrant 并使用 Docker 作为支持提供程序
如果您查看 Vagrant 源代码,您会发现我的错误来自 this line of code,而对于 VirtualBox 提供者来说,它来自 this usable method 引发错误。如果 usable 方法认为 VirtualBox 的版本无效 (VirtualBoxInvalidVersion) 或在本地系统上未检测到 (VirtualBoxNotDetected),则会引发错误。
不是 Ruby 开发人员,我现在很难弄清楚 Vagrant 是如何决定抛出这两个错误中的任何一个。但我认为我越来越接近于弄清楚为什么 Docker 会占用我的 Vagrant/VirtualBox 配置。
原问题:
这里是 Mac。几天前我像这样安装了Vagrant 和VirtualBox:
brew cask install virtualbox
brew cask install vagrant
brew cask install vagrant-manager
...它让它 Vagrant 启动并运行没有任何问题。我可以vagrant init hashicorp/precise32; vagrant up 并且一切看起来都运行得很完美(hashicorp/precise32 默认使用 VirtualBox)。
然后昨晚我安装了Docker,它也需要VirtualBox,并且启动并运行没有任何问题。我什至能够让whalesay 容器示例正常工作。到目前为止一切顺利。
今天我去 Vagrant 玩,看起来我的 Docker 安装破坏了我的 Vagrant/VirtualBox 配置。
现在,当我在一个空目录上运行vagrant init hashicorp/precise32,然后运行vagrant up,我得到:
myuser@mymac:~/sandbox/myapp$vagrant up
No usable default provider could be found for your system.
Vagrant relies on interactions with 3rd party systems, known as
"providers", to provide Vagrant with resources to run development
environments. Examples are VirtualBox, VMware, Hyper-V.
The easiest solution to this message is to install VirtualBox, which
is available for free on all major platforms.
If you believe you already have a provider available, make sure it
is properly installed and configured. You can see more details about
why a particular provider isn't working by forcing usage with
`vagrant up --provider=PROVIDER`, which should give you a more specific
error message for that particular provider.
然后我尝试指定提供程序类型,即使我不应该这样做,只是为了看看会发生什么:
myuser@mymac:~/sandbox/myapp$vagrant up --provider=VirtualBox
The provider 'VirtualBox' could not be found, but was requested to
back the machine 'cortex'. Please use a provider that exists.
为了更好地衡量,运行vagrant -v 会产生Vagrant 1.7.2 作为输出。
任何想法出了什么问题以及解决方法是什么?
【问题讨论】:
-
我在安装 docker 工具箱后遇到了类似的问题,运行此命令后修复
rm -r ~/.vagrant.d/plugins.json ~/.vagrant.d/gems -
感谢@BMW,但这对我不起作用。
-
Ubuntu 12.04 不建议使用 docker,因为 docker 需要 Linux 内核 3.13+。虽然你可以在里面运行
sudo apt-get update && sudo apt-get install linux-image-generic-lts-trusty来升级内核,但我还是建议你改用Ubuntu 14.04。 -
好像你的virtualbox感知有问题,试试手动下载安装吧。
-
你是如何安装 Docker 的?你用过OS X installer from the Docker site吗?也许重新安装 Vagrant,然后安装 Docker — 但这次进行自定义安装,不要安装 VirtualBox(请参阅 step 4's screenshot)。