Now that we've learned a bit about Docker, we can get to the fun part! In this section, we will go through an example of using Docker to provision a Vagrant machine. One thing to note is that Vagrant will attempt to install Docker so that you don't have to. Interestingly, Docker is run within the Vagrant machine, not on your host machine. You'll see this as you will be able to SSH into the Vagrant machine and run Docker commands.
Let's get started and provision our Vagrant machine using Docker:
- To begin, run the vagrant init -m command to create a minimal Vagrantfile.
- In our Vagrantfile, let's add in a provision block:
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.network "forwarded_port", guest: 80, host: 8081
config.vm.provision...