Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between a Vagrant Provider and a Vagrant Provisioner?

I think the words "Provider" and "Provisioner" sound very similar which may lead to confusion especially among beginners confronted with documentation where both terms are mixed up or used synonymous (already seen on the net). Even more confusing it gets when beginners see Docker as Provider and Docker as Provisioner mentioned on Vagrant´s website.

So this question is actually about three things:

  1. What is a Vagrant Provider?

  2. What is a Vagrant Provisioner?

  3. How does Docker fit in here?

    • What could be a typical use case for Docker as Vagrant Provider?

    • What could be a typical use case for Docker as Vagrant Provisioner?

I appreciate explanations, examples and links for further reading which illustrate things clearly (even for noobs).

like image 812
Wlad Avatar asked Aug 10 '16 11:08

Wlad


People also ask

What is a Vagrant provider?

Providers are the services that Vagrant uses to set up and create virtual environments. Support for VirtualBox, Hyper-V, and Docker virtualization ships with Vagrant, while VMware and AWS are supported via plugins.

What is a Vagrant provisioner?

Provisioners in Vagrant allow you to automatically install software, alter configurations, and more on the machine as part of the vagrant up process. This is useful since boxes typically are not built perfectly for your use case.

How do I set up a Vagrant provider?

To make this experience better, Vagrant allows specifying the default provider to use by setting the VAGRANT_DEFAULT_PROVIDER environmental variable. Just set VAGRANT_DEFAULT_PROVIDER to the provider you wish to be the default.


2 Answers

  1. The underlying virtualization solutions are called providers. To work with Vagrant, you have to install at least one provider (e.g. Virtualbox, VMWare)

  2. Provisioning in Vagrant is the process of automatic installation and configuration of the system within during $ vagrant up and the tools to perform this operation are called provisioners (e.g. Shell scripts, Chef, Puppet).

like image 92
k0chan Avatar answered Sep 24 '22 00:09

k0chan


Provider vs Provisioner

Vagrant uses Providers such as hypervisors (e.g VirtualBox, Hyper-V) or Docker to create and run virtual environments. Vagrant uses Provisioners (e.g Ansible, Puppet, Chef) as configuration tools to customize these environments, e.g carrying out installs and starting apps.

How does Docker fit in?

If a hypervisor is used as a Provider, the environment that is created is a virtual machine based on a self-contained image of an operating system environment as provided by a “Vagrantbox” (aka “box”). The box is utilized by Vagrant to create a dedicated kernel and set of operating system processes for the virtual machine.

If Docker is used as a Provider and Docker is available on the host system, Vagrant manages and runs containers directly on the host system. Here Vagrant is not actually building and managing a virtual machine but rather is working with the Docker engine running on the host to manage and build Docker containers.

like image 22
jmdeamer Avatar answered Sep 23 '22 00:09

jmdeamer