October 2018
Beginner
232 pages
7h 52m
English
Using the post_install_provisioner option offers you an easy way to run a provisioner once the original provisioner has run. This sounds a little confusing, but it essentially allows you to create a new provision block within the Docker one. You could use Docker as your main provisioner and then, inside, use a shell provisioner which runs when the Docker one has finished.
An example Vagrantfile would look like this:
Vagrant.configure("2") do |config| config.vm.box = "ubuntu/xenial64" config.vm.network "forwarded_port", guest: 80, host: 8081 config.vm.provision "docker" do |dock| dock.post_install_provision "shell", inline:"touch /vagrant/index.html && echo '<h1>Hello World!</h1>' > /vagrant/index.html" dock.run ...Read now
Unlock full access