2013-09-03 18:08:28 +00:00
|
|
|
---
|
2016-01-19 18:08:53 +00:00
|
|
|
layout: "docs"
|
2013-09-06 16:50:43 +00:00
|
|
|
page_title: "vagrant box - Command-Line Interface"
|
2013-09-03 18:08:28 +00:00
|
|
|
sidebar_current: "cli-box"
|
2016-01-19 18:08:53 +00:00
|
|
|
description: |-
|
|
|
|
The "vagrant box" command is used to manage "vagrant box add", "vagrant box
|
|
|
|
remove", and other box-related commands such as "outdated", "list", and
|
|
|
|
"update".
|
2013-09-03 18:08:28 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# Box
|
|
|
|
|
|
|
|
**Command: `vagrant box`**
|
|
|
|
|
2016-01-19 18:08:53 +00:00
|
|
|
This is the command used to manage (add, remove, etc.) [boxes](/docs/boxes.html).
|
2013-09-03 18:08:28 +00:00
|
|
|
|
|
|
|
The main functionality of this command is exposed via even more subcommands:
|
|
|
|
|
2017-05-31 10:21:31 +00:00
|
|
|
* [`add`](#box-add)
|
|
|
|
* [`list`](#box-list)
|
|
|
|
* [`outdated`](#box-outdated)
|
2017-06-15 14:16:25 +00:00
|
|
|
* [`prune`](#box-prune)
|
2017-05-31 10:21:31 +00:00
|
|
|
* [`remove`](#box-remove)
|
|
|
|
* [`repackage`](#box-repackage)
|
|
|
|
* [`update`](#box-update)
|
2013-09-03 18:08:28 +00:00
|
|
|
|
|
|
|
# Box Add
|
|
|
|
|
2014-01-25 20:18:41 +00:00
|
|
|
**Command: `vagrant box add ADDRESS`**
|
2013-09-03 18:08:28 +00:00
|
|
|
|
2014-01-25 20:18:41 +00:00
|
|
|
This adds a box with the given address to Vagrant. The address can be
|
|
|
|
one of three things:
|
2013-09-03 18:08:28 +00:00
|
|
|
|
2014-01-25 20:18:41 +00:00
|
|
|
* A shorthand name from the
|
2017-05-22 16:42:31 +00:00
|
|
|
[public catalog of available Vagrant images](https://vagrantcloud.com/boxes/search),
|
2014-01-25 20:18:41 +00:00
|
|
|
such as "hashicorp/precise64".
|
2013-09-03 18:08:28 +00:00
|
|
|
|
2017-05-22 16:42:31 +00:00
|
|
|
* File path or HTTP URL to a box in a [catalog](https://vagrantcloud.com/boxes/search).
|
2014-01-25 20:18:41 +00:00
|
|
|
For HTTP, basic authentication is supported and `http_proxy` environmental
|
|
|
|
variables are respected. HTTPS is also supported.
|
|
|
|
|
|
|
|
* URL directly a box file. In this case, you must specify a `--name` flag
|
2016-01-19 18:08:53 +00:00
|
|
|
(see below) and versioning/updates will not work.
|
2013-09-03 18:08:28 +00:00
|
|
|
|
2013-11-24 00:00:43 +00:00
|
|
|
If an error occurs during the download or the download is interrupted with
|
|
|
|
a Ctrl-C, then Vagrant will attempt to resume the download the next time it
|
2016-05-27 19:18:50 +00:00
|
|
|
is requested. Vagrant will only attempt to resume a download for 24 hours
|
2013-11-24 00:00:43 +00:00
|
|
|
after the initial download.
|
|
|
|
|
2013-09-03 18:08:28 +00:00
|
|
|
## Options
|
|
|
|
|
2014-01-25 20:18:41 +00:00
|
|
|
* `--box-version VALUE` - The version of the box you want to add. By default,
|
|
|
|
the latest version will be added. The value of this can be an exact version
|
|
|
|
number such as "1.2.3" or it can be a set of version constraints. A version
|
|
|
|
constraint looks like ">= 1.0, < 2.0".
|
|
|
|
|
2013-11-27 03:32:56 +00:00
|
|
|
* `--cacert CERTFILE` - The certificate for the CA used to verify the peer.
|
2016-01-19 18:08:53 +00:00
|
|
|
This should be used if the remote end does not use a standard root CA.
|
2013-11-27 03:32:56 +00:00
|
|
|
|
2014-05-21 03:51:21 +00:00
|
|
|
* `--capath CERTDIR` - The certificate directory for the CA used to verify the peer.
|
2016-01-19 18:08:53 +00:00
|
|
|
This should be used if the remote end does not use a standard root CA.
|
2014-05-19 15:41:13 +00:00
|
|
|
|
2013-11-26 00:54:39 +00:00
|
|
|
* `--cert CERTFILE` - A client certificate to use when downloading the box, if
|
|
|
|
necessary.
|
|
|
|
|
2013-11-24 00:00:43 +00:00
|
|
|
* `--clean` - If given, Vagrant will remove any old temporary files from
|
2016-01-19 18:08:53 +00:00
|
|
|
prior downloads of the same URL. This is useful if you do not want Vagrant
|
2013-11-24 00:00:43 +00:00
|
|
|
to resume a download from a previous point, perhaps because the contents
|
|
|
|
changed.
|
|
|
|
|
|
|
|
* `--force` - When present, the box will be downloaded and overwrite any
|
|
|
|
existing box with this name.
|
|
|
|
|
2016-01-19 18:08:53 +00:00
|
|
|
* `--insecure` - When present, SSL certificates will not be verified if the
|
2013-11-24 00:00:43 +00:00
|
|
|
URL is an HTTPS URL.
|
|
|
|
|
2016-01-19 18:08:53 +00:00
|
|
|
* `--provider PROVIDER` - If given, Vagrant will verify the box you are
|
2013-09-03 18:08:28 +00:00
|
|
|
adding is for the given provider. By default, Vagrant automatically
|
|
|
|
detects the proper provider to use.
|
|
|
|
|
2014-01-25 20:18:41 +00:00
|
|
|
## Options for direct box files
|
|
|
|
|
2016-01-19 18:08:53 +00:00
|
|
|
The options below only apply if you are adding a box file directly (when
|
|
|
|
you are not using a catalog).
|
2014-01-25 20:18:41 +00:00
|
|
|
|
|
|
|
* `--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
|
2016-01-19 18:08:53 +00:00
|
|
|
also be specified. If you are downloading from a catalog, the checksum is
|
2014-01-25 20:18:41 +00:00
|
|
|
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
|
2016-01-19 18:08:53 +00:00
|
|
|
a catalog, the name is included in the catalog entry and does not have
|
2014-01-25 20:18:41 +00:00
|
|
|
to be specified.
|
|
|
|
|
2016-01-19 18:08:53 +00:00
|
|
|
<div class="alert alert-warning">
|
2017-05-22 16:42:31 +00:00
|
|
|
<strong>Checksums for versioned boxes or boxes from HashiCorp's Vagrant Cloud:</strong>
|
|
|
|
For boxes from HashiCorp's Vagrant Cloud, the checksums are embedded in the metadata
|
2016-01-19 18:08:53 +00:00
|
|
|
of the box. The metadata itself is served over TLS and its format is validated.
|
2014-03-01 11:08:27 +00:00
|
|
|
</div>
|
|
|
|
|
2013-09-03 18:08:28 +00:00
|
|
|
# Box List
|
|
|
|
|
|
|
|
**Command: `vagrant box list`**
|
|
|
|
|
|
|
|
This command lists all the boxes that are installed into Vagrant.
|
|
|
|
|
2014-01-25 20:18:41 +00:00
|
|
|
# Box Outdated
|
|
|
|
|
|
|
|
**Command: `vagrant box outdated`**
|
|
|
|
|
2016-01-19 18:08:53 +00:00
|
|
|
This command tells you whether or not the box you are using in
|
2014-01-25 20:18:41 +00:00
|
|
|
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.
|
|
|
|
|
2013-11-25 21:46:53 +00:00
|
|
|
## Options
|
|
|
|
|
2014-01-25 20:18:41 +00:00
|
|
|
* `--global` - Check for updates for all installed boxes, not just the
|
|
|
|
boxes for the current Vagrant environment.
|
2013-11-25 21:46:53 +00:00
|
|
|
|
2017-05-28 01:04:17 +00:00
|
|
|
# Box Prune
|
|
|
|
|
|
|
|
**Command: `vagrant box prune`**
|
|
|
|
|
|
|
|
This command removes old versions of installed boxes. If the box in currently in use vagrant will ask you if you to confirm.
|
|
|
|
|
|
|
|
## 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.
|
|
|
|
|
2013-09-03 18:08:28 +00:00
|
|
|
# Box Remove
|
|
|
|
|
2014-01-25 20:18:41 +00:00
|
|
|
**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
|
2014-04-13 10:24:22 +00:00
|
|
|
what versions to delete with the `--box-version` flag or remove all versions
|
|
|
|
with the `--all` flag.
|
2014-01-25 20:18:41 +00:00
|
|
|
|
|
|
|
## Options
|
|
|
|
|
|
|
|
* `--box-version VALUE` - Version of version constraints of the boxes to
|
|
|
|
remove. See documentation on this flag for `box add` for more details.
|
2013-09-03 18:08:28 +00:00
|
|
|
|
2014-04-13 10:24:22 +00:00
|
|
|
* `--all` - Remove all available versions of a box.
|
|
|
|
|
2014-05-01 01:50:00 +00:00
|
|
|
* `--force` - Forces removing the box even if an active Vagrant
|
|
|
|
environment is using it.
|
|
|
|
|
2014-01-25 20:18:41 +00:00
|
|
|
* `--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.
|
2013-09-03 18:08:28 +00:00
|
|
|
|
|
|
|
# Box Repackage
|
|
|
|
|
2014-10-23 04:16:23 +00:00
|
|
|
**Command: `vagrant box repackage NAME PROVIDER VERSION`**
|
2013-09-03 18:08:28 +00:00
|
|
|
|
|
|
|
This command repackages the given box and puts it in the current
|
2014-10-23 04:16:23 +00:00
|
|
|
directory so you can redistribute it. The name, provider, and version
|
2015-02-27 20:18:17 +00:00
|
|
|
of the box can be retrieved using `vagrant box list`.
|
2013-09-03 18:08:28 +00:00
|
|
|
|
|
|
|
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.
|
2014-01-25 20:18:41 +00:00
|
|
|
|
|
|
|
# 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.
|
|
|
|
|
|
|
|
Note that updating the box will not update an already-running Vagrant
|
2016-01-19 18:08:53 +00:00
|
|
|
machine. To reflect the changes in the box, you will have to destroy and
|
2014-01-25 20:18:41 +00:00
|
|
|
bring back up the Vagrant machine.
|
|
|
|
|
|
|
|
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.
|