Use Vagrant with Docker · modius.io

Use Vagrant with Docker

25 May 2014

“Vagrant is not for managing machines, Vagrant is for managing development environments”, Mitchell Hashimoto

Mitchell’s quote comes direct from the comments of an interesting “Docker vs Vagrant” Stackoverflow question. Worth a read if only because a founder from both the Docker (Solomon Hykes) and Vagrant (Mitchell Hashimoto) projects provided answers.

Vagrant 1.6 was only recently released (MAY 6 2014) with its official support for Docker in tow. A lot of older Docker tutorials incorrectly position Vagrant as a competitor to Docker.

Vagrant is for managing development environments and traditionally does this by provisioning virtual machines. Docker.io is another form of virtualisation — stands to reason that Vagrant might be useful.

Vagrant can make Docker easier by:

  • provisioning a lean virtual machine for the docker daemon; essential for windows and osx environments
  • handling file syncing into containers
  • managing network port forwarding
  • making vagrant ssh handy
  • tailing container logs and more

Admittedly, many features are of limited use if you are already running a flavour of linux that can can handle Docker natively. But if you must go through a virtual machine, its a constant pain to be juggling commands/ports/syncs from the host to the docker virtual machine and then on to the containers.

Vagrant is like rum'n'raisin with lemon sorbet; it complements Docker development.

Plus there’s the convenience of having the same vagrant up workflow available and standard across developers using different operating environments. Not to mention everyday virtual machines are at your finger tips when Docker itself is not an option for your project.

Enjoy!


This is a companion discussion topic for the original entry at http://modius.io/2014/05/25/use-vagrant-with-docker/

As native docker tooling gets better (eg. Docker Toolbox) I’m sure we’ll look to move to a more native solution. At least for now, Its still too hard to pass up the options for host provisioning, and the fiddly parts of getting virtual box to run seamlessly on mixed developer workstations.