47 lines
2.0 KiB
Plaintext
47 lines
2.0 KiB
Plaintext
---
|
|
layout: docs
|
|
page_title: vagrant package - Command-Line Interface
|
|
description: |-
|
|
The "vagrant package" command is used to package a currently-running
|
|
VirtualBox or Hyper-V vagrant environment into a reusable Vagrant box.
|
|
---
|
|
|
|
# Package
|
|
|
|
**Command: `vagrant package [name|id]`**
|
|
|
|
This packages a currently running _VirtualBox_ or _Hyper-V_ environment into a
|
|
re-usable [box](/vagrant/docs/boxes). This command can only be used with
|
|
other [providers](/vagrant/docs/providers/) based on the provider implementation
|
|
and if the provider supports it.
|
|
|
|
## Options
|
|
|
|
- `--base NAME` - Instead of packaging a VirtualBox machine that Vagrant
|
|
manages, this will package a VirtualBox machine that VirtualBox manages.
|
|
`NAME` should be the name or UUID of the machine from the VirtualBox GUI.
|
|
Currently this option is only available for VirtualBox.
|
|
**In a multi-machine environment, the UUID is required.** This info can be
|
|
gathered in two different ways `ls -l ~/VirtualBox\ VMs` or `vboxmanage list vms`.
|
|
|
|
- `--output NAME` - The resulting package will be saved as `NAME`. By default,
|
|
it will be saved as `package.box`.
|
|
|
|
- `--include x,y,z` - Additional files will be packaged with the box. These
|
|
can be used by a packaged Vagrantfile (documented below) to perform additional
|
|
tasks.
|
|
|
|
- `--info path/to/info.json` - The package will include a custom JSON file containing
|
|
information to be displayed by the [list](/vagrant/docs/cli/box#box-list) command when invoked
|
|
with the `-i` flag
|
|
|
|
- `--vagrantfile FILE` - Packages a Vagrantfile with the box, that is loaded
|
|
as part of the [Vagrantfile load order](/vagrant/docs/vagrantfile/#load-order)
|
|
when the resulting box is used.
|
|
|
|
-> **A common misconception** is that the `--vagrantfile`
|
|
option will package a Vagrantfile that is used when `vagrant init`
|
|
is used with this box. This is not the case. Instead, a Vagrantfile
|
|
is loaded and read as part of the Vagrant load process when the box is
|
|
used. For more information, read about the [Vagrantfile load order](/vagrant/docs/vagrantfile/#load-order).
|