Skip to content

Instantly share code, notes, and snippets.

@fmasuhr
Last active June 27, 2022 03:25
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save fmasuhr/4fd661b884f157590613 to your computer and use it in GitHub Desktop.
Save fmasuhr/4fd661b884f157590613 to your computer and use it in GitHub Desktop.
Associate a Vagrant project directory with an existing VirtualBox VM
  1. Run the following command and copy the ID of your VM
VBoxManage list vms
=> "virtualMachine" {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
  1. Go to the Vagrant project configuration folder
cd .vagrant/machines/default/virtualbox
  1. Create a file called id without a newline but the ID of your VM xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
echo -n 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' > id
  1. In the directory where your Vagrantfile of the associated VM is located, run Vagrant with new config
vagrant up
@carlos-ht
Copy link

thank you so much!

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