So I have read this in many places that docker is faster and more efficient because it uses containers over VMs but when I downloaded docker on my mac I realized that it uses virtual box to run the containers. I believe on a linux machine docker doesn't need virtual box and can run on Linux Kernel. Is this correct ?
Back to original question. Is docker still faster/efficient because it uses a single VM to run multiple containers as opposed to Vargrant's new VM for every environment ?
I believe on a linux machine docker doesn't need virtual box and can run on Linux Kernel. Is this correct ?
Yes, hence the need for a VirtualBox Linux VM (using a TinyCore distribution)
Is docker still faster/efficient because it uses a single VM to run multiple containers as opposed to Vargrant's new VM for every environment ?
Yes, because of the lack of Hypervisor simulating the hardware and OS: here you can launch multiple containers all using directly the kernel (through direct system calls), without having to simulate an OS.
(Note: May 2018, gVisor is another option: a container, simulating an OS!)
See more at "How is Docker different from a normal virtual machine?".
Of course, remember that Vagrant can use a docker provider.
That means you don't have to always provision a full-fledged VM with Vagrant, but rather images and containers.
Vagrant.configure("2") do |config|
config.vm.provider "docker" do |d|
d.image = "foo/bar"
end
end