Run vagrant -v to show the version. If you are not running the latest version
of Vagrant, please upgrade before submitting an issue.
latest
This is the operating system that you run locally.
mac osx 10.11.3
This is the operating system you run in the virtual machine.
need support xhyve ( a lightweight OS X virtualization solution)
https://github.com/mist64/xhyve
Vagrant.configure(2) do |config|
config.vm.provider "docker" do |d|
d.image = "centos"
end
end
$ vagrant up --provider=docker
Bringing machine 'default' up with 'docker' provider...
==> default: Docker host is required. One will be created if necessary...
default: Vagrant will now create or start a local VM to act as the Docker
default: host. You'll see the output of the `vagrant up` for this VM below.
default:
default: Checking if box 'hashicorp/boot2docker' is up to date...
What should have happened?
native docker use Xhyve, no need boot2docker any more.
What actually happened?
still go with boot2docker
Are there any other GitHub issues (open or closed) that should be linked here?
For example:
If this is possible, no vagrant boxes required any more.
"Faster and more reliable: no more VirtualBox! The Docker engine is running in an Alpine Linux distribution on top of an xhyve Virtual Machine on Mac OS X or on a Hyper-V VM on Windows, and that VM is managed by the Docker application. You don’t need docker-machine to run Docker for Mac and Windows."
Hi there,
Thank you for opening an issue. This is closely related to https://github.com/mitchellh/vagrant/issues/6187. In general, we prefer to see new technologies developed as plugins first, then, as they gain maturity and adoption, we can address moving them into Vagrant core. Thanks!
I'd just like drop a friendly note to document that this is not about supporting xhyve per #6187, but is actually about supporting docker using the now-native implementations on windows and os x. These native implementations do not use boot2docker anymore and instead handle the starting and management of a docker environment directly, which vagrant should interact with via the standard docker mechanisms.
specifically vagrant should NOT try to start any VMs when docker is requested under these systems.
Vagrant should instead just use docker directly similarly to how it behaves on a linux system.
thanks to add comments on this idea, @diddledan
We need develop a new vagrant driver to support xhyve first, without this plug-in, we can't go further.
Hi @diddledan
The next version of Vagrant allows the user to opt out of the host-VM using an envvar; this will be a good gap that will allow users to use the native tools while they are still in beta.
@sethvargo does this feature exist yet, e.g. in a beta?
Thanks, @sethvargo
Any sample Vagrantfile for sharing to set force_host_vm to true. I'd like to work it with native docker for mac
Plus one for this guys. Native support for Docker for Mac (and Windows) is now out a beta.
It already exists and was in 1.8.4 if I recall correctly.
@sethvargo
Still doesn't work with native docker for mac.
Used the sample and copy from https://www.vagrantup.com/docs/docker/commands.html
$ vagrant --version
Vagrant 1.8.4
$ cat Vagrantfile
Vagrant.configure(2) do |config|
config.vm.provider "docker" do |d|
d.image = "consul"
end
end
$ vagrant up --provider=docker
Bringing machine 'default' up with 'docker' provider...
==> default: Docker host is required. One will be created if necessary...
default: Docker host VM is already ready.
==> default: Syncing folders to the host VM...
default: Installing rsync to the VM...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
rsync --help
Stdout from the command:
Stderr from the command:
sh: rsync: not found
$ docker version
Client:
Version: 1.12.1
API version: 1.24
Go version: go1.6.3
Git commit: 23cf638
Built: Thu Aug 18 17:32:24 2016
OS/Arch: darwin/amd64
Experimental: true
Server:
Version: 1.12.1
API version: 1.24
Go version: go1.6.3
Git commit: 23cf638
Built: Thu Aug 18 17:32:24 2016
OS/Arch: linux/amd64
Experimental: true
Did with Vagrant 1.8.5, same error.
You need to set force_host_vm to false, as Seth mentioned. Try:
Vagrant.configure(2) do |config|
config.vm.provider "docker" do |d|
d.image = "consul"
d.force_host_vm = false
end
end
@mvermaes
Thanks, I can start with docker provider with native docker for mac.
I am fine to close this ticket now.
Command: ["docker", "run", "--name", "tmp_default_1474432125", "-d", "-v", "/private/tmp:/vagrant", "consul", {:notify=>[:stdout, :stderr]}]
https://github.com/mitchellh/vagrant/issues/7240#issuecomment-235645658
i think d.force_host_vm is unfortunately bad name. to tell vagrant not to use own boot2docker, i have to tell:
d.force_host_vm = false
which may lead to believe vagrant by default forces. it's a bit illogical to say "force=false", the better option would be to make boolean variable:
# use xhyve
d.use_host_vm = true
# use boot2docker
d.use_host_vm = false
ps: d.force_host_vm = false boots here with vagrant 1.9.0, but it's unable to ssh in because it uses container internal ip, not the mapped one:
# docker ps
ed239a2b4c94 vagrant "/usr/local/sbin/sshd" 11 minutes ago Up 11 minutes 127.0.0.1:2200->22/tcp dind_default_1480510372
````
but vagrant connects to:
INFO ssh: Invoking SSH: ssh ["[email protected]", "-p", "22", "-o", "Compression=yes", "-o", "DSAAuthentication=yes", "-o", "LogLevel=FATAL", "-o", "IdentitiesOnly=yes", "-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null", "-i", "/Users/glen/.vagrant.d/insecure_private_key", "-o", "ForwardAgent=yes"]
```
it should connect to 127.0.0.1:2200
is there known workaround to tell the hostname:port to vagrant?
ok, found answer from here:
config.ssh.host = 'localhost'
config.ssh.guest_port = '2200'
I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
You need to set force_host_vm to false, as Seth mentioned. Try: