macos - Vagrant 和 Docker 玩得不好

标签 macos docker vagrant

更新:我已经卸载了 Vagrant 和 Docker,并将接受任何有助于我重新安装它们的答案:

  1. 我可以在不依赖 Docker 的情况下运行 Vagrant;和
  2. 我可以在不依赖 Vagrant 的情况下运行 Docker;和
  3. 我可以运行 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 hashcorp/precise32; vagrant up 一切看起来都运行得很完美(hashicorp/precise32 默认使用 VirtualBox)。

然后昨晚我安装了Docker ,这也需要 VirtualBox,并且可以毫无问题地启动和运行。我什至能够让 whalesay 容器示例正常工作。到目前为止一切顺利。

今天我去 Vagrant 玩,看起来我的 Docker 安装破坏了我的 Vagrant/VirtualBox 配置。

现在,当我在一个空目录上运行 vagrant init hashcorp/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 作为输出。

任何想法出了什么问题以及解决方法是什么?

最佳答案

Vagrant 关心大小写(至少 Vagrant 1.8.1 如此),所以提供者名称使用小写:

vagrant up --provider=virtualbox

我认为 1.8.1 的错误信息更有帮助:

$ vagrant up --provider=VirtualBox  # NOTE: this is the WRONG capitalization
An active machine was found with a different provider. Vagrant
currently allows each machine to be brought up with only a single
provider at a time. A future version will remove this limitation.
Until then, please destroy the existing machine to up with a new
provider.

Machine name: default
Active provider: virtualbox
Requested provider: VirtualBox

您还可以在 Vagrantfile 中设置默认提供程序。

关于macos - Vagrant 和 Docker 玩得不好,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32085381/

相关文章:

macos - 无法打开显示错误

vagrant - 无法让 modernIE 的 vagrant specific box 与 vagrant 一起工作

ansible - 如何将ansible变量传递给vagrant

docker - 在 Docker Swarm 副本上使用 Traefik 进行 session 持久化

linux - 运行 Docker 镜像

Vagrant 未在 33.33.33.10 上运行

python - 在路径中使用带有空格的 virtualenv

swift - 如何从应用程序委托(delegate)访问 NSViewController?

java - 如何在 El Capitan 上降级 Java

docker - 如何更新基于 docker 的安装的 soanr.properties