简体   繁体   中英

If docker uses virtual machine to run on a mac then what is its advantage over vagrant?

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!)

vm vs容器

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

See Vagrant docker provisioner .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM