vagrant box

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

box 是一个打包好的操作系统,是一个后缀名为 .box 的文件,其实是一个压缩包,里面包含了 Vagrant 的配置信息和 VirtualBox 的虚拟机镜像文件

查看现在本机上所拥有的box:

userdeMBP:~ user$ vagrant box list
hashicorp/precise64 (virtualbox, 1.1.0)

现在本机上有hashicorp/precise64这个box

查看命令vagrant box下的子命令有:

https://www.vagrantup.com/docs/cli/box.html

1》add

格式:

vagrant box add [options] <name, url, or path>

添加一个box到本地

userdeMBP:~ user$ vagrant box add -h
Usage: vagrant box add [options] <name, url, or path> Options: -c, --clean Clean any temporary download files清除任何临时下载文件
-f, --force Overwrite an existing box if it exists如果存在,覆盖现有的box
--insecure Do not validate SSL certificates 不验证SSL证书
--cacert FILE CA certificate for SSL download 用于SSL下载的CA证书
--capath DIR CA certificate directory for SSL download 用于SSL下载的CA证书目录
--cert FILE A client SSL cert, if needed 如果需要,客户端SSL证书
--location-trusted Trust 'Location' header from HTTP redirects and use the same credentials for subsequent urls as for the initial one
HTTP重定向的可信“Location”头,并对后续url使用与初始url相同的凭据
--provider PROVIDER Provider the box should satisfy box满意的Provider,即使用的Provider
--box-version VERSION Constrain version of the added box 约束添加的box的版本 The box descriptor can be the name of a box on HashiCorp's Vagrant Cloud,or a URL, or a local .box file, or a local .json file containing the catalog metadata.
box描述符,即<name, url, or path> 可以是HashiCorp vagrant云上的一个box的名称、URL、本地 .box文件或包含目录元数据的本地 .json 文件 The options below only apply if you're adding a box file directly, and not using a Vagrant server or a box structured like 'user/box':
以下选项只适用于你直接添加一个box文件,而不是使用一个vagrant服务器或一个结构类似“user/box”的box: --checksum CHECKSUM Checksum for the box box的校验和
--checksum-type TYPE Checksum type (md5, sha1, sha256) 校验和类型
--name BOX Name of the box 为box起的名字
-h, --help Print this help 打印帮助

⚠️校验和:

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或来自HashiCorp vagrant云的box的校验和:

对于来自HashiCorp vagrant云的box,校验和嵌入在box的元数据中。元数据本身是通过TLS提供的,它的格式是经过验证的

2》list

格式:

vagrant box list [options]

这个命令列出了安装到Vagrant中的所有boxes

userdeMBP:~ user$ vagrant box list -h
Usage: vagrant box list [options] Options: -i, --box-info Displays additional information about the boxes 显示关于这些boxes的其他信息
-h, --help Print this help 打印帮助信息

3》outdated

格式:

vagrant box outdated [options]

检查正在使用的box是否有可用的新版本。如果传入--global标志,将检查所有boxes是否有更新
检查更新涉及刷新与某个box关联的元数据。这通常需要网络连接

userdeMBP:~ user$ vagrant box outdated -h
Usage: vagrant box outdated [options] Checks if there is a new version available for the box that are you are using. If you pass in the --global flag, all boxes will be checked for updates.
检查正在使用的box是否有可用的新版本。如果传入--global标志,将检查所有boxes是否有更新 Options: --global Check all boxes installed 检查所有已安装的boxes
--insecure Do not validate SSL certificates 不验证SSL证书
--cacert FILE CA certificate for SSL download 用于SSL下载的CA证书
--capath DIR CA certificate directory for SSL download 用于SSL下载的CA证书目录
--cert FILE A client SSL cert, if needed 如果需要,使用的客户端SSL证书
-h, --help Print this help 打印帮助信息

4》prune

格式:

vagrant box prune [options]

此命令删除已安装框的旧版本。如果该箱子目前正在使用,vagrant将要求确认

userdeMBP:~ user$ vagrant box prune -h
Usage: vagrant box prune [options] Options: -p, --provider PROVIDER The specific provider type for the boxes to destroy. 要销毁的指定提供provider类型的boxes
-n, --dry-run Only print the boxes that would be removed. 只打印要删除的boxes
--name NAME The specific box name to check for outdated versions. 要检查的指定过时版本的box名字
-f, --force Destroy without confirmation even when box is in use. 即使box在使用中,也要在未经确认的情况下销毁。即强制销毁
-h, --help Print this help 打印帮助信息

5》remove

格式:

vagrant box remove <name>

此命令从vagrant中删除与给定名称匹配的box

如果一个box有多个providers,必须要使用--provider标签指定确切的provider;如果一个box有多个版本,你可以使用--box-version标签选择你要删除的版本,或者使用--all标签删除所有版本

userdeMBP:~ user$ vagrant box remove -h
Usage: vagrant box remove <name> Options: -f, --force Remove without confirmation. 强制删除
--provider PROVIDER The specific provider type for the box to remove 要删除该指定provider类型的box
--box-version VERSION The specific version of the box to remove 删除该指定版本的box
--all Remove all available versions of the box 删除box的所有可用版本
-h, --help Print this help 打印帮助信息

6》repackage

格式:

vagrant box repackage <name> <provider> <version>

这个命令重新打包给定的box,并将其放到当前目录中,以便你可以重新分发它。可以使用vagrant box list命令检索该box的名称、provider和版本。

当你添加一个box时,Vagrant会将其解包并存储在内部。原来的*.box文件不保存。这个命令对于从安装的vagrant box 回收*.box文件非常有用。

只有-h,--help 这个option

7》update

格式:

vagrant box update [options]

如果在当前vagrant环境下有可用的更新,此命令将对box进行更新。该命令还可以通过指定--box标志更新特定的框(在活动的vagrant环境之外)。

请注意,更新此box不会更新已经运行的vagrant机器。为了反映box里的变化,你必须摧毁并重新启动这台vagrant机器

如果你只是想检查是否有可用的更新,请使用vagrant box outdated命令

userdeMBP:~ user$ vagrant box update -h
Usage: vagrant box update [options] Updates the box that is in use in the current Vagrant environment,if there any updates available. This does not destroy/recreate the machine, so you'll have to do that to see changes.
如果有可用的更新,则更新当前vagrant环境中使用的box。这不会破坏/重新创建机器,所以你必须这样做才能看到更改。 To update a specific box (not tied to a Vagrant environment), use the --box flag.
要更新特定的框(不绑定到vagrant环境),请使用--box标志 Options: --box BOX Update a specific box 更新指定的box
--provider PROVIDER Update box with specific provider 更新指定provider的box
-f, --force Overwrite an existing box if it exists 只要存在就强制复写该存在的box
--insecure Do not validate SSL certificates 不验证SSL证书
--cacert FILE CA certificate for SSL download 用于SSL下载的CA证书
--capath DIR CA certificate directory for SSL download 用于SSL下载的CA证书目录
--cert FILE A client SSL cert, if needed 如果需要,使用的客户端SSL证书
-h, --help Print this help 打印帮助信息

virtualbox+vagrant学习-2(command cli)-1-vagrant box命令的更多相关文章

  1. virtualbox+vagrant学习-2(command cli)-17-vagrant ssh命令

    SSH 格式: vagrant ssh [options] [name|id] [-- extra ssh args] 这将SSH导入正在运行的vagrant机器,并允许你访问机器的shell. us ...

  2. virtualbox+vagrant学习-2(command cli)-26-vagrant share命令

    Share share命令初始化了一个vagrant share会话,允许你与世界上任何一个人共享vagrant环境,允许在几乎任何网络环境中直接在vagrant环境中进行协作. 你可以在本博客的vi ...

  3. virtualbox+vagrant学习-2(command cli)-2-vagrant cloud命令--有问题

    Cloud https://www.vagrantup.com/docs/cli/cloud.html 命令: vagrant cloud 这是用来管理与vagrant相关的任何东西的命令. 该命令的 ...

  4. virtualbox+vagrant学习-2(command cli)-7-vagrant login命令

    Login ⚠️该命令已经弃用了,别名为vagrant cloud auth login.看本博客的 格式: vagrant cloud auth login [options] 登录命令用于使用Ha ...

  5. virtualbox+vagrant学习-2(command cli)-11-vagrant PowerShell命令

    PowerShell 格式: vagrant powershell [-- extra powershell args] 这将在主机上打开PowerShell提示符,进入正在运行的vagrant机器. ...

  6. virtualbox+vagrant学习-2(command cli)-4-vagrant global-status命令

    Global Status 格式: vagrant global-status 这个命令将告诉你当前登录的用户系统上所有活跃的vagrant环境的状态. userdeMacBook-Pro:~ use ...

  7. virtualbox+vagrant学习-2(command cli)-21-vagrant up命令

    Up 格式: vagrant up [options] [name|id] 这个命令根据你的Vagrantfile文件创建和配置客户机. 这是“vagrant”中最重要的一个命令,因为它是创建任何va ...

  8. virtualbox+vagrant学习-2(command cli)-23-vagrant version命令

    Version 格式: vagrant version options只有 -h, --help 该命令将告诉你已安装的vagrant版本以及当前可用的vagrant最新版本. userdeMacBo ...

  9. virtualbox+vagrant学习-2(command cli)-24-Aliases别名

    Aliases 别名的部分灵感来自Git自身的别名功能,它允许你创建自己的定制vagrant命令,从而使你的vagrant体验更简单.更容易.更熟悉. 别名可以在VAGRANT_HOME/ alias ...

随机推荐

  1. 分布式ID生成器PHP+Swoole实现(下) - 代码实现

    上篇文章主要介绍<实现原理>,这篇看主要代码的编写. 实现IDGenerator类 64位ID由以下元素组成:固定位占2位,时间戳占41位,服务实例数字编号占4位,业务编号占10位,自增i ...

  2. linux的目录结构及文件基本操作

    1. linux的文件组织目录结构 linux的目录与window的区别 win以存储介质为主,主要以盘符及分区实现文件 管理,再下面才是目录. linux以树形目录结构的形式来构造整个系统,每一个目 ...

  3. JSP简单实现统计网页访问次数

    JSP简单实现统计网页访问次数 需求:统计网页的访问次数 核心思想:利用application对象,将访问次数的信息放入application对象中,每次访问就+1.这里利用了application对 ...

  4. Java 时区转换(UTC+8 到 UTC 等等)

    前言:需要做时区转换,知道北京为UTC+8,东京为UTC+9,世界标准时间为UTC,所以下面的代码是只需要知道时区是+8还是+9还是0就可以了,不需要使用"CTT". " ...

  5. KDTree(Bzoj2648: SJY摆棋子)

    题面 传送门 KDTree 大概就是一个分割\(k\)维空间的数据结构,二叉树 建立:每层选取一维为关键字,把中间的点拿出来,递归左右,有个\(STL\)函数nth_element可以用一下 维护:维 ...

  6. PyCharm导入包的问题

    在此之前,我们说一下虚拟环境这个概念: 在django项目中,直接就安装各种package,可能会造成系统混乱,因为package之间会有依赖的.比方说,你现在直接装django,他会依赖其他的包(开 ...

  7. Node.js 学习笔记(一)--------- Node.js的认识和Linux部署

    Node.js 一.Node.js 简介  简单的说 Node.js 就是运行在服务端的可以解析并运行 JavaScript 脚本的软件. Node.js 是一个基于Chrome JavaScript ...

  8. ShareSDK分享和SMS的使用

    使用的是第三方的Mob来实现分享和发送短信的Demo 如图是项目的结构,结合了分享,发送短信,读取短信内容的功能 代码地址:https://github.com/1825492258/MobShare ...

  9. Linux常用命令(一)————查找和替换

    1. 查找一个字符串 一个字符串是一行上的一个或几个字符.    为查找一个字符串,在vi命令模式下键入“/”,后面跟要查找的字符串,再按回车.vi将光标定位在该串下一次出现的地方上.键入n跳到该串的 ...

  10. Windows Server 2008 R2 /2012 修改密码策略(摘抄 原文地址 https://www.cnblogs.com/mili3/p/7799347.html)

    今天建了域环境,在添加新用户的时候,发现用简单的密码时域安全策略提示密码复杂度不够,于是我就想在域安全策略里面把密码复杂度降低一点. 问题:    在“管理工具 >> 本地安全策略 > ...