Skip to content

Instantly share code, notes, and snippets.

@dasgoll
Last active September 23, 2021 11:56
Show Gist options
  • Save dasgoll/ec783b996b93d0caea4f to your computer and use it in GitHub Desktop.
Save dasgoll/ec783b996b93d0caea4f to your computer and use it in GitHub Desktop.
the 'repackage' command creates a distributable box file from the unpacked box in your ~/.vagrant.d/boxes directory.
Let's say you "vagrant box add" a box named centos.box from an URL
vagrant will extract centos.box in your vagrant home folder (the box format is just a tar file)
in my case ~/.vagrant.d/boxes/centos
In that folder you will see files like :
[root@goll tmp]# ls ~/.vagrant.d/boxes/centos65/0/virtualbox/
box-disk1.vmdk box.ovf metadata.json Vagrantfile
say that you deleted this centos_x86_64.box, and no longer have it.
When you run "vagrant box repackage centos65 virtualbox 0"
vagrant will create a new tar file in the current directory named package.box containing those 3 files.
@Thinkscape
Copy link

thx

@snahil
Copy link

snahil commented Jul 17, 2019

How one can create vagrant package from a running vagrant box in virtual box with just a size in MB

@VProfirov
Copy link

This still doesn't explain the difference between:
vagrant package --base NAME --output NAME
&
vagrant box repackage NAME PROVIDER VERSION

P.S. I am searching for more info on the subject and the diff, if any.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment