[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can run under boot2docker? #5

Closed
anentropic opened this issue Nov 21, 2014 · 11 comments
Closed

can run under boot2docker? #5

anentropic opened this issue Nov 21, 2014 · 11 comments

Comments

@anentropic
Copy link

I'd love to see is some discussion/instruction of what needs to be done different when running under boot2docker, I'm assuming the part where you share the host's /var/run/docker.sock as a volume isn't going to work.

I found some instructions here:
http://www.devopslife.com/2014/08/08/docker-boot2docker-and-dns-resolution-of-containers.html

It's aimed at skydock but the first part would be the same I think. However in comments people say this no longer works for docker 1.3.1 due to some change

I'd also love to see an example fig.yml for running dnsdock as a service under fig

@anentropic
Copy link
Author

sorry, I just spotted the OSX section at the bottom of the front page readme :)

@anentropic
Copy link
Author

ok my intuition was wrong, this works fine:

docker run -d -v /var/run/docker.sock:/var/run/docker.sock --name dnsdock -p 172.17.42.1:53:53/udp tonistiigi/dnsdock

but I'm having trouble with the rest of it...

@anentropic
Copy link
Author

"Open file /etc/default/docker and add -bip=172.17.42.1/24 -dns 172.17.42.1 to DOCKER_OPTS variable. Restart docker daemon after you have done that"

My attempt to follow this under boot2docker is:

  • from a hint here it seems like I should boot2docker ssh and then edit the file /var/lib/boot2docker/profile adding a line DOCKER_OPTS="-bip=172.17.42.1/24 -dns 172.17.42.1"
  • boot2docker restart

then I run the dnsdock container as instructed

then "In your Vagrantfile add the following to let your virtual machine accept packets for other IPs" ...boot2docker isn't backed by Vagrant any more so I went to the VirtualBox GUI and edited the network settings for boot2docker-vm so that 'Adapter 2' was set to 'Promiscuous Mode: Allow All' ...seemed best match for the instructions

for this part:

sudo route -n add -net 172.17.0.0 <VAGRANT_MACHINE_IP>

...I assumed this is running on my OSX host. I got the IP address from boot2docker ip

added a file (on OSX host again) /etc/resolver/myprojectname.docker

then boot2docker restart again for good luck

@anentropic
Copy link
Author

I'm not sure how to test it's working, but this output doesn't look like yours so I think it isn't:

$ dig *.docker

; <<>> DiG 9.8.3-P1 <<>> *.docker
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 1312
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;*.docker.          IN  A

;; AUTHORITY SECTION:
.           508 IN  SOA a.root-servers.net. nstld.verisign-grs.com. 2014112101 1800 900 604800 86400

;; Query time: 20 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Fri Nov 21 23:22:49 2014
;; MSG SIZE  rcvd: 101

@tonistiigi
Copy link
Collaborator

I tried boot2docker and everything seemed to work fine for me. I didn't even need to set the Promiscuous mode thing.

In boot2docker profile the correct format for daemon arguments seems to be EXTRA_ARGS="" (https://github.com/boot2docker/boot2docker/blob/master/doc/FAQ.md) but this mostly changes how containers find each other so I don't think this is the main issue.

If you make a file /etc/resolver/myprojectname.docker pointing to the docker bridge you can only find domains under myprojectname.docker. If you want to search *.docker you need to name this file docker. Btw, I have had trouble renaming these files, its safer to remove and create new.

How to debug:

  • Log into boot2docker ssh, run ip addr and confirm docker0 has IP 172.17.42.1
  • ping 172.17.42.1 from OSX.
  • query directly from the server dig @172.17.42.1 docker

@anentropic
Copy link
Author

this morning I tried to undo everything I did above and try a different approach

coming back to it... my docker0 has IP 172.17.42.1 from inside boot2docker but ping 172.17.42.1 from osx host fails

@anentropic
Copy link
Author

I had changed the promiscuity of the vm back to 'deny', removed the route etc

@tonistiigi
Copy link
Collaborator

I upgraded to 1.3.1 and was hit by boot2docker/boot2docker#606 so make sure you can ping to the boot2docker ip first.

Is the route visible with netstat -nr? After the upgrade I also had to remove the old route first sudo route -n delete -net 172.17.0.0 192.168.59.103 and add it again with sudo route -n add -net 172.17.0.0 192.168.59.103. Probably because the vbox interfaces changed.

Other than that everything worked fine in 1.3.1 as well. Again, didn't touch the Promiscuous mode settings, but did create the host-only adapters again to be able to connect to boot2docker ip.

@anentropic
Copy link
Author

I can ping the boot2docker ip fine, but not the docker0 one

I can ping 172.17.42.1 once ssh'd into the boot2docker vm, but not from the osx host

@tonistiigi
Copy link
Collaborator

Don't know then, sorry. Must be some differences in virtualbox or osx(I'm using yosemite). route should forward all traffic going to 172.17.*.* to vm. I'm not sure why it isn't doing this for you.

Does sudo route -n get 172.17.42.1 list the boot2docker ip as gateway?

@anentropic
Copy link
Author

ah thanks, the problem is I had deleted the route and not added it back again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants