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:
What is a Vagrant Provider?
What is a Vagrant Provisioner?
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).
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.
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.
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.
The underlying virtualization solutions are called providers. To work with Vagrant, you have to install at least one provider (e.g. Virtualbox, VMWare)
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).
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With