3.1-Box

Box

命令: vagrant box

这是用于管理(添加,删除等)box的命令。

该命令的主要功能通过更多的子命令实现:

Box Add

命令:vagrant box add ADDRESS

通过一个给定地址在Vagrant中增加box。地址可以是以下三类:

  • [可用的Vagrant镜像的公共目录](https://vagrantcloud.com/boxes/search)中的简写名称,如“hashicorp / precise64”。

  • box的文件路径或HTTP URL[目录](https://vagrantcloud.com/boxes/search)。对于HTTP,支持基本身份验证并且遵守http_proxy环境变量。 同时支持HTTPS。

  • 网址直接指向一个box文件。在这种情况下,您必须指定--name标志(请参见下文),版本控制/更新将不起作用。

如果在下载过程中发生错误,或者下载被Ctrl-C中断,则Vagrant将在下次请求时尝试恢复下载。Vagrant只会尝试在首次下载后24内恢复下载。

»选项

[»](https://www.vagrantup.com/docs/cli/box.html#options-for-direct-box-files)直接box文件的选项

下面的选项仅适用于直接添加box文件(当您不使用目录时)。

** HashCorp的Vagrant Cloud版本化框或框的校验和:**对于来自HashiCorp的Vagrant Cloud的框,校验和被嵌入到框的元数据中。元数据本身通过TLS提供,其格式经过验证。

»Options for direct box files

The options below only apply if you are adding a box file directly (when you are not using a catalog).

  • --checksum VALUE - A checksum for the box that is downloaded. If specified, Vagrant will compare this checksum to what is actually downloaded and will error if the checksums do not match. This is highly recommended since box files are so large. If this is specified, --checksum-type must also be specified. If you are downloading from a catalog, the checksum is included within the catalog entry.

  • --checksum-type TYPE - The type of checksum that --checksum is if it is specified. Supported values are currently "md5", "sha1", and "sha256".

  • --name VALUE - Logical name for the box. This is the value that you would put into config.vm.box in your Vagrantfile. When adding a box from a catalog, the name is included in the catalog entry and does not have to be specified.

Checksums for versioned boxes or boxes from HashiCorp's Vagrant Cloud: For boxes from HashiCorp's Vagrant Cloud, the checksums are embedded in the metadata of the box. The metadata itself is served over TLS and its format is validated.

Box List

Command: vagrant box list

This command lists all the boxes that are installed into Vagrant.

Box Outdated

Command: vagrant box outdated

This command tells you whether or not the box you are using in your current Vagrant environment is outdated. If the --global flag is present, every installed box will be checked for updates.

Checking for updates involves refreshing the metadata associated with a box. This generally requires an internet connection.

»Options

  • --global - Check for updates for all installed boxes, not just the boxes for the current Vagrant environment.

Box Prune

Command: vagrant box prune

This command removes old versions of installed boxes. If the box is currently in use vagrant will ask for confirmation.

»Options

  • --provider PROVIDER - The specific provider type for the boxes to destroy.

  • --dry-run - Only print the boxes that would be removed.

  • --name NAME - The specific box name to check for outdated versions.

  • --force - Destroy without confirmation even when box is in use.

Box Remove

Command: vagrant box remove NAME

This command removes a box from Vagrant that matches the given name.

If a box has multiple providers, the exact provider must be specified with the --provider flag. If a box has multiple versions, you can select what versions to delete with the --box-version flag or remove all versions with the --all flag.

»Options

  • --box-version VALUE - Version of version constraints of the boxes to remove. See documentation on this flag for box add for more details.

  • --all - Remove all available versions of a box.

  • --force - Forces removing the box even if an active Vagrant environment is using it.

  • --provider VALUE - The provider-specific box to remove with the given name. This is only required if a box is backed by multiple providers. If there is only a single provider, Vagrant will default to removing it.

Box Repackage

Command: vagrant box repackage NAME PROVIDER VERSION

This command repackages the given box and puts it in the current directory so you can redistribute it. The name, provider, and version of the box can be retrieved using vagrant box list.

When you add a box, Vagrant unpacks it and stores it internally. The original *.box file is not preserved. This command is useful for reclaiming a *.box file from an installed Vagrant box.

Box Update

Command: vagrant box update

This command updates the box for the current Vagrant environment if there are updates available. The command can also update a specific box (outside of an active Vagrant environment), by specifying the --box flag.

<small style="box-sizing: border-box; font-size: 12.75px;">Note that updating the box will not update an already-running Vagrant machine. To reflect the changes in the box, you will have to destroy and bring back up the Vagrant machine.</small>

If you just want to check if there are updates available, use the vagrant box outdated command.

»Options

  • --box VALUE - Name of a specific box to update. If this flag is not specified, Vagrant will update the boxes for the active Vagrant environment.

  • --provider VALUE - When --box is present, this controls what provider-specific box to update. This is not required unless the box has multiple providers. Without the --box flag, this has no effect.

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 204,684评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 87,143评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,214评论 0 337
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,788评论 1 277
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,796评论 5 368
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,665评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,027评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,679评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 41,346评论 1 299
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,664评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,766评论 1 331
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,412评论 4 321
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,015评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,974评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,203评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,073评论 2 350
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,501评论 2 343

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,285评论 0 10
  • 今晚流氓兔推荐的歌曲是《甘心替代你》,郑伊健。特别喜欢前面部分唱的,好好听。又好深情。 三天过去了,我归来啦。发生...
    佐恬阅读 192评论 0 0
  • 没有想过自己的第一篇居然是为了工作,用“居然”这个词对我来说一点也不意外。一直以来工作于我只是生活的一部分其...
    小家女雄阅读 538评论 0 1
  • 『亮剑』里有个场景:李云龙带着一营趴在土堆上,看到日本兵的大阵仗,直觉告诉他再等一等,会等到大鱼。于是他从一个天亮...
    呼葱唤土豆阅读 251评论 2 2
  • 文/山雨林夕 一寸光阴一寸金,寸金难买寸光阴。 在宝爸宝妈们的世界里,时间是最珍贵的存在。 每天都恨不得有三个自己...
    山雨林夕阅读 424评论 0 0