-
Notifications
You must be signed in to change notification settings - Fork 15
/
setup-howto.txt
102 lines (63 loc) · 5.03 KB
/
setup-howto.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
1. Install Docker Toolbox
2. Install and setup weave http://weave.works/guides/weave-and-docker-platform/weavenetwork.html. Note that if you want to use a custom domain
(instead of the default weave.local.) you pass an option to weave launch:
weave launch --dns-domain="ojbc.local."
After doing this, you need to set weave environment variables:
eval $(weave env)
3. The weave router acts as a full-fledged virtual switch and firewall between the "uber host" (your Mac), docker machine hosts, and containers running
inside the docker machines. However, the intra-host network (that allows inter-container communication between containers running on the same
host) is not, by default, exposed to other hosts or to the Mac. To instruct the router to expose this "host LAN" to your Mac, you need to tell it:
weave expose
Note that the intra-host LAN uses the 10.32.0.0/16 subnet. This will be important to know for the next step. (I believe you can tell weave to use
other subnets, but why on earth would you want to mess with that?? :) )
4. That is only half of the puzzle, though. The IP stack on your Mac still doesn't know what to do with an address like 10.32.0.1. You need to tell it
to use the weave router's host as the gateway for that subnet:
sudo route add -net 10.32.0.0/16 $(docker-machine ip weave-1)
5. For the bridged adapter in the docker-machine VM to be able to deal with packets from other subnets, you need to set its promiscuous mode to "allow".
You can do this through the VirtualBox Manager GUI (select the VM, Network, the bridged adapter, and use the drop-down to set it).
Or you can do it from the command line:
VBoxManage modifyvm weave-1 --nicpromisc2 allow-all
Note that you have to shut down the VM before you do this (either command-line or GUI):
docker-machine stop weave-1
You will then need to start the VM
docker-machine start weave-1
Since your restarted the VM, you will then need to run
weave launch
eval $(weave env)
weave expose
After completing steps 1-5, assuming you've started the "pingme" (run "docker start pingme") container as described in the tutorial, you should be able to ping its IP address from your Mac. Assume it is 10.32.0.1 (which it should be if it's the only container you have running).
*If you are unable to ping 10.32.0.1 from your Mac and you're certain you followed the steps above, chances are the static route is incorrect (this could happen if you end up having to install the weave-1 docker machine a couple times, since each time ou install it, it VB gives it a new IP Address). So, try the following to remove the existing static route and add a new one:
sudo route delete -net 10.32.0.0/16 $(docker-machine ip weave-1)
sudo route add -net 10.32.0.0/16 $(docker-machine ip weave-1)
$ traceroute 10.32.0.1
traceroute to 10.32.0.1 (10.32.0.1), 64 hops max, 52 byte packets
1 192.168.99.103 (192.168.99.103) 0.394 ms 0.262 ms 0.223 ms
2 10.32.0.1 (10.32.0.1) 0.237 ms 0.376 ms 0.283 ms
6. Last step is to get DNS working. MacOS uses BSD's resolver daemon to service name resolution requests for local domains.
See http://hints.macworld.com/article.php?story=2004062902195410 if you're curious. For our purpose:
sudo mkdir /etc/resolver/ # assuming it doesn't already exist
sudo echo "nameserver 172.17.0.1" > /etc/resolver/weave.local
Of course, replace "weave.local" with whatever alternative domain you chose (if any) in step 2.
172.17.0.1 is the IP addy of the weave router (which also has a DNS server for names running in the weave fabric) on the default docker bridge network.
For whatever reason, weave does not expose weavedns via the 10.32.x.x IP address, so you have to use the docker bridge.
You also need to add the 172.17.0.0/16 subnet to route through the docker-machine gateway:
sudo route add -net 172.17.0.0/16 $(docker-machine ip weave-1)
Anyway after completing this step, you should be able to do:
$ ping -c3 pingme.weave.local
PING pingme.weave.local (10.32.0.1): 56 data bytes
64 bytes from 10.32.0.1: icmp_seq=0 ttl=63 time=0.189 ms
64 bytes from 10.32.0.1: icmp_seq=1 ttl=63 time=0.373 ms
64 bytes from 10.32.0.1: icmp_seq=2 ttl=63 time=0.367 ms
--- pingme.weave.local ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.189/0.310/0.373/0.085 ms
Note that the name of the machine in WeaveDNS will be whatever you called it when you started/ran the container
# # # #
A few notes:
* You can get the status of the weave service with:
weave status
In particular, under the DNS section, you should see an entry counted for each container you've started up
* You can see detailed status of the weave dns service with:
weave status dns
* The process of auto-registering containers with weave does not seem to work if you just start them. You have to run them, with the weave containers up.
* To determine the IP address of a container: docker-machine ip weave-1