Use Vagrant with Docker

Reading time ~1 minute

“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. 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.