Vagrant无法找到现有的虚拟机镜像。

6

我使用本地文件添加了一个盒子,文件来源于https://dl.dropboxusercontent.com/s/x1085661891dhkz/lxc-centos6.5-2013-12-02.box

命令:vagrant box add centos centos.box

命令:vagrant init centos

我的shell:

cheneytekimbp:vagrant-centos zicjin$ vagrant box list
centos  (lxc, 0)
lucid32 (virtualbox, 0)
cheneytekimbp:vagrant-centos zicjin$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'centos' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Adding box 'centos' (v0) for provider: virtualbox
    default: Downloading: centos
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

Couldn't open file /Users/zicjin/Work/vagrant-centos/centos

1
如果您已经下载了该文件,请使用vagrant box add /path/to/lxc-centos6.5-2013-12-02.box命令将其添加到Vagrant中。 - Terry Wang
4个回答

7

使用文件协议URI和完整路径添加本地框文件。例如:

vagrant box add centos file:///Users/zicjin/Work/vagrant-centos/centos.box

(当然,确切的位置取决于您放置文件的位置)

1
$ vagrant box add CentOSMinimal  https://dl.dropbox.com/u/7225008/Vagrant/CentOS-6.3-x86_64-minimal.box
 $ vagrant init CentOSMinimal
 $ vagrant up

1
如果你使用的是Windows操作系统,你可以将路径定义为:
vagrant box add box_name "C:\Users\JohnDoe\blahblah\box_name.box"

注意路径结尾处的 .box
如果你还没有在该目录下,可以使用 cd 命令进入该目录,然后执行 vagrant up

0

我曾解决过类似的问题,升级Vagrant到最新版本后,它就神奇地正常工作了... :/


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接