Docker with Vagrant In the Labs

Now that you’re familiar with Vagrant, we’re going to use it to create a Docker environment for your project. If you haven’t yet familiarized yourself with Vagrant, please do so before continuing.

We’ll be using the turnes/udocker box. At the time of writing this document, the box was running the latest version of Docker (19.03.8). If you find it out of date, please feel free to use a different box, create your own with the latest version, or update this one.

Vagrantfile

Your Vagrantfile for this box will need to contain at least the name of the box and setting the virtual serial port of the vm to ‘disconnected’.

Vagrant.configure("2") do |config|
    config.vm.box = "turnes/udocker"
    config.vm.provider "virtualbox" do |v|
        v.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ]
    end
end

Shared Directories

If your project needs to share data with the Vagrant box (It most likely will.) mount it like so in the Vagrantfile.

config.vm.synced_folder "../dir/to/mount", "/path/to/mount/in/box"