Vagrant Cheat Sheet
Vagrant Cheat Sheet
—————————————————————————————————————
Install Vagrant
—————————————————————————————————————
Getting into a VM
Cleaning up a VM
Boxes
Provisioning Commands
config.vm.provision "shell",
inline: "echo Hello, World"
———————————————————————————————————
OR
Vagrantfile
Port Forwarding
config.vm.network "forwarded_port", guest: 80, host: 8080
maps port 80 of the VM to port 8080 on the host machine
———————————————————————————————————
Sharing Folder
What is a Snapshot
Full copy of the VM in its Current state
All configurations - disk contents, apps, packages, folders, memory
Creates backup of the Virtual Machine
Restoring the VM from an earlier state
Plugin Commands
Tips
References:
Vagrant: https://developer.hashicorp.com/vagrant/downloads
Virtualbox: https://www.virtualbox.org/wiki/Downloads
Vagrantfile Box Search: https://app.vagrantup.com/boxes/search
Vagrantfile Generator: https://vagrantfile-generator.vercel.app/
Available Plugins : https://github.com/hashicorp/vagrant/wiki/Available-
Vagrant-Plugins