Introduction to Vagrant Docker Development VM

VagrantVM

With Vagrant you’re getting a fast, easy, local and secure development platform for Windows, MacOS or Linux. Fully configured and ready to use in some minutes with all services preconfigured. Don’t waste your time with manual configuration or installation. Vagrant is the right tool for it.

In addition to the Docker Boilerplate I’ve also created a Vagrant Docker Development VM for running Docker containers in Windows, MacOS and Linux.

I’m not using Boot2Docker because of the missing host to guest file sharing (Samba or fast VM specific sharing). Also Windows developers need their development environment and within a Busybox you can’t develop nicely. IMHO a docker container is not a real development environment and it should be customisable by each developer for their needs so is switched to Vagrant with Ubuntu base image.

VMware or Parallels also provides much faster virtualisation, network and filesystem access than VirtualBox and these solutions don’t have any critical bugs like host crashes or dropped network packages I’ve sometimes got with VirtualBox.
But if anyone want to use VirtualBox my Vagrant VM have support also for VirtualBox..

You just need one of these virtualisation solutions, for Windows you should go for VMware Workstation (Player is not supported for Vagrant) and for MacOS you should go for Parallels.
Then you also need git (or you have to download the ZIPed package) and Vagrant.
Vagrant is a terminal tool so if you want something with a graphical interface try Vagrant Manager.

Here are the steps for brining up the Vagrant VM with terminal commands:

vagrant up can take some times – mostly 20 minutes – and will install a bunch of packages to a Ubuntu base distribution. Most of these packages are development tools.

Also the provisioning will install a mail sandbox so all emails will be redirected to an internal postfix server – even if you send them to an outside mailserver!

For Windows developers there is also a Samba share but you can also use SSH/SCP sharing.

Also a HTTP and HTTPS reverse proxy (Apache2) is setup which redirects all *.vm domains to port 8000 (Docker containers).

CliTools are also pre-installed and pre-configured.

In your home directroy there is a /home/vagrant/projects/ folder where you can put your Docker instances or projects. This folder is located on the second data disk with 60 GiB storage.
You can also use project sharing via NFS if you’re working under MacOS – your MacOS home directory is available in the VM so you can connect to Docker daemon from your MacOS and start Docker containers as in VM. NFS sharing is a little bit slower so make sure your caching files are not transfered via NFS.

If you’re an advanced Vagrant user you can also create an rsync or unison share which will be much faster but you need at least twice the disk space.

Hint: Provisioning of the VM is done with ansible and customized provisioning is planed for the next version.

If you got any success stories or some suggestions just leave a comment – thanks.

References:

I'm working as DevOps (software developer and linux administrator) in a TYPO3 agency in Stuttgart. I love OpenSource technologies like Linux and PHP and I'm want to share knowledge and experience.

1 Comment

  1. Florian (PanadeEdu) Tatzel

    2015-06-20 - 3:46 pm
    Reply

    As Windows User, I absolutely can recommend the switch from VirtualBox to VMware.
    For long enough I defended VirtualBox and found workarounds for all kind of things, lately I just had enough and bought that VMware Workstation and the Vagrant seed.
    What can I say…. it works faster with lesser problems. No network interrupts or lags… boy even my Samba share working with PHPstorm has no lags anymore. Even the syncing of my project files works seamless at some point while still providing a normally working Website.

    Strongly recommend optimising the Virtualisation for all Users!
    VirtualBox for me, its just not worth it anymore.
    I better spend 200-300 bucks on a good software than waiting around 1 Hour daily to actually work plus more for Troubleshooting.

Leave a Reply