Create Debian VM with Docker Host using Vagrant–automatically include Guest Additions

0
Share this on .. Tweet about this on TwitterShare on LinkedIn1Share on Facebook0Share on Google+0Email this to someoneShare on Tumblr0Buffer this page

A short and simple article. I needed a Debian VM that I could use as Docker host – to run on my Windows 10 laptop. I resorted to Vagrant. With a few very simple steps, I got what I wanted:

0. install Vagrant (if not already done)

0. install Vagrant plugin for automatically adding Virtual Box Guest Additions to every VM stamped out by Vagrant (so folder mapping from host laptop to VM is supported)

image

1. create a fresh directory with a simple Vagrant file that refers for Debian image

2. run vagrant up

3. sit back and relax (few minutes)

4. use vagrant ssh to connect into the running VM and start doing stuff.

The vagrant file:

Vagrant.configure(“2”) do |config|
 
config.vm.provision “docker”

config.vm.define “debiandockerhostvm”
# https://app.vagrantup.com/debian/boxes/jessie64
config.vm.box = “debian/jessie64”
config.vm.network “private_network”, ip: “192.168.188.102”
 

config.vm.synced_folder “./”, “/vagrant”, id: “vagrant-root”,
       owner: “vagrant”,
       group: “www-data”,
       mount_options: [“dmode=775,fmode=664”],
       type: “”
        
config.vm.provider :virtualbox do |vb|
   vb.name = “debiandockerhostvm”
   vb.memory = 4096
   vb.cpus = 2
   vb.customize [“modifyvm”, :id, “–natdnshostresolver1”, “on”]
   vb.customize [“modifyvm”, :id, “–natdnsproxy1”, “on”]
end
 
end

Running Vagrant to create and subsequently run the VM:

image

image

Use vagrant ssh to enter the Virtual Machine and start mucking around:

image

Resources

Vagrant Plugin for automatically installing Guest Addition to each VM that is produced: https://github.com/dotless-de/vagrant-vbguest/

Vagrant Box Jessie: https://app.vagrantup.com/debian/boxes/jessie64

Share this on .. Tweet about this on TwitterShare on LinkedIn1Share on Facebook0Share on Google+0Email this to someoneShare on Tumblr0Buffer this page

About Author

Lucas Jellema, active in IT (and with Oracle) since 1994. Oracle ACE Director and Oracle Developer Champion. Solution architect and developer on diverse areas including SQL, JavaScript, Docker, Machine Learning, Java, SOA and microservices, events in various shapes and forms and many other things. Author of the Oracle Press books: Oracle SOA Suite 11g Handbook and Oracle SOA Suite 12c Handbook. Frequent presenter on community events and conferences such as JavaOne, Oracle Code and Oracle OpenWorld.

Leave a Reply