Vagrant | Boxes | Docs

CM for VM-based Development Environments

Why not docker container?
Docker designed for single process; no systemd, etc.
Why not docker-machine VM?
Vagrant does synched folders, whereas docker-machine mount fails @ Win/WSL.

Install (Git-for-Windows) shell.

Commands

Ad hoc

# Verify (List Commands)
vagrant
# Init (creates VagrantFile)
vagrant init
# Add the Box (Download box image)
vagrant box add $_MAKER/$_BOX
# Start/Boot the VM/OS [per specified provider]
vagrant up [--provider=hyperv|virtualbox|vmware|libvirt|docker|...]  

Configured

# Create(Download)/Start/Boot the image/VM/OS 
vagrant up 
# (Re)Provision (if up already)
vagrant provision
# Restart [+(Re)Provision] 
vagrant reload [--provision] [--debug] 
# Login 
vagrant ssh 

VM per se

# VM commands (pause|resume|stop)
vagrant up|suspend|resume|halt
# Terminate VM (Removes @ Hyper-V)
vagrant destroy
# Remove the (downloaded) Box
vagrant box remove

Project Setup (Getting Started)

Configure

Vagrantfile (Hyper-V specific)

# if Vagrant API Version: "2"
Vagrant.configure("2") do |config|

    # Base box
    config.vm.box = "generic/ubuntu1604"

    # @ Hyper-V 
    config.vm.provider "hyperv" do |h|
        # VM name
        h.vmname = "vagrant.generic.ubuntu1604"
        # Improve spin-up time
        h.enable_virtualization_extensions = true
        # h.differencing_disk = true # depricated
        h.linked_clone = true
    end

    # Network  
    config.vm.network "public_network"
    
    # Synched Folder(s)
    # Disable (SMB) a Synched Folder (default @ Hyper-V)
    config.vm.synced_folder ".", "/vagrant", disabled: true
    # Enable (SMB) a Synched Folder (required @ Hyper-V)
    config.vm.synced_folder ".", "/vagrant"

    # Upload file(s) to guest (VM)
    config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig"

    # Run host script(s) @ guest (VM)
    config.vm.provision :shell, path: "bootstrap.sh"
end