Best way to centralize downloaded boxes among all users of a host system (like putting .vagrant.d dir on a network store)

8 views
Skip to first unread message

barry higgins

unread,
Mar 10, 2020, 6:32:12 PM3/10/20
to Vagrant
I'd like to conserve storage space for multiple users downloading the same vagrant boxes. Normally, each user will have a .vagrant.d directory in the home directory, and the .vagrant.d directory will have the downloaded box. So if I have 2 users on a linux host, and each user runs `vagrant box add "hashicorp/bionic64"`, then there will be two copies of the hashicorp/bionic64 box on the system. My goal is to have a central location on the system so that if two users run `vagrant box add "hashicorp/bionic64"`, only one copy will be saved on disk (and downloaded).

Thanks.

JP Toto

unread,
Mar 10, 2020, 9:32:23 PM3/10/20
to vagra...@googlegroups.com
You can set the VAGRANT_HOME environment variable for each user https://www.vagrantup.com/docs/other/environmental-variables.html#vagrant_home which will override the /.vagrant.d/ home. I'm not _entirely_ sure you're going to want to do that for multiple users to share but it's worth trying out.

On Tue, Mar 10, 2020 at 6:32 PM barry higgins <jorda...@gmail.com> wrote:
I'd like to conserve storage space for multiple users downloading the same vagrant boxes. Normally, each user will have a .vagrant.d directory in the home directory, and the .vagrant.d directory will have the downloaded box. So if I have 2 users on a linux host, and each user runs `vagrant box add "hashicorp/bionic64"`, then there will be two copies of the hashicorp/bionic64 box on the system. My goal is to have a central location on the system so that if two users run `vagrant box add "hashicorp/bionic64"`, only one copy will be saved on disk (and downloaded).

Thanks.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/e77e618c-6461-4323-b961-6eb1f80912fe%40googlegroups.com.


--
JP Toto   |   james....@gmail.com   |   http://jptoto.jp   |   @jptoto

barry higgins

unread,
Mar 11, 2020, 10:44:09 AM3/11/20
to Vagrant
Great! Thank you.

I also wasn't sure it would work, but looks like this github gist that does exactly what I needed has plenty of satisfied users/forks:


Quoting the gist:

Reconfigure VirtualBox and Vagrant home directory for Windows Set VirtualBox home directory to: C:\VMs Store vagrant boxes: C:\VMs\vagrant.d

# VirtualBox home directory.
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" setproperty machinefolder "C:\VMs"
# Vagrant home directory for downloadad boxes.
REG ADD HKCU
\Environment /v VAGRANT_HOME /t REG_SZ /d "C:\VMs\vagrant.d"
Reply all
Reply to author
Forward
0 new messages