Closed jbenet closed 10 years ago
Temp hack. Add this to Vagrantfile:
config.vm.network :forwarded_port, guest: 4243, host: 4243 # docker
then run:
vagrant up
vagrant ssh
sudo killall docker
sudo docker -d -H tcp://0.0.0.0:4243 &
(tried setting as an inline shell provision script, but it doesn't work-- config.vm.provision
expects bash, and boot2docker doesn't have bash).
And now in the host, run:
docker -H=tcp://0.0.0.0:4243 ps
This should be added to readme
In addition to it,
https://github.com/steeve/boot2docker
If you want to use the brand new Docker OSX client, just tell it to connect to localhost and you should be good to go. boot2docker will automatically detect if it's running in a VirtualBox/QEMU/VMWare and will let dockerd listen on all interfaces
$ export DOCKER_HOST=localhost
$ docker version
It works with just 4243 port forwarding as above @jbenet .
@YungSang does it work without changing the daemon to use tcp? it usually listens on the unix socket, and at least for me, port 4342 isn't bound to any process before manually restarting docker.
@jbenet Yes, it does.
I followed the instruction to install OSX Client in README.md at https://github.com/steeve/boot2docker .
And also I put export DOCKER_HOST=localhost
into ~/.bash_profile .
My Vagrantfile:
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "boot2docker"
config.vm.box_url = "https://github.com/mitchellh/boot2docker-vagrant-box/releases/download/v0.4.0/boot2docker.box"
config.vm.network :forwarded_port, guest: 4243, host: 4243
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024"]
end
end
$ vagrant up
$ docker version
It works for me. I even build boot2docker through this.
The Vagrant template used by Packer for this box specifies the port forward needed for Docker by default since 0.5.4. Setting the env using export DOCKER_HOST=localhost
results in a working docker version
, properly connected to the vm (using the OS X docker binary). Verified for both VMWare Fusion and Virtualbox.
Think this one can be closed, aside from perhaps an update to the readme.
I have a very simple Vagrantfile, and setting DOCKER_HOST=localhost
isn't working for me. I get the following:
☄ export DOCKER_HOST=localhost && docker version 2014/03/12 14:35:11 Invalid bind address format: localhost
I installed docker 0.8.1 with homebrew.
Vagrantfile:
Vagrant.configure(2) do |config|
config.vm.box = "boot2docker"
config.vm.box_url = "https://github.com/mitchellh/boot2docker-vagrant-box/releases/download/v0.5.4/boot2docker_virtualbox.box"
end
This worked for me: export DOCKER_HOST=tcp://localhost:4243
boot2docker sets up the docker daemon (in the guest vm) to listen to the client (in the host). This is useful, as docker commands can be run from the host.
One option:
/var/run/docker.sock
)config.vm.network :forwarded_port, guest:<port>, host: <port>
boot2docker-vagrant-box
readme says "usedocker -H localhost:<port>
from the host"