Weave Networking for DockerΒΆ

Weave creates a virtual network that enables users to connect docker containers on different host and enable their auto-discovery

Install Weave

$ sudo wget -O /usr/local/bin/weave \
$ sudo chmod a+x /usr/local/bin/weave

Launch weave containers

$ weave launch

This command will internally pull weave router container and run it

Start two application containers on weave network

$ C=$(weave run -t -i ubuntu)
$ C12=$(weave run -t -i ubuntu)

C and C12 hold the containerId of the containers created

$ echo $C
$ echo $C12

weave run command will internally run docker run -d command in order to set the ip address of weave network and start the ubuntu containers. Test the connection between two containers connected via weave network by using the ping command

$ docker attach $C
$ ping -c 4
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=64 time=0.119 ms
64 bytes from icmp_seq=2 ttl=64 time=0.152 ms
64 bytes from icmp_seq=3 ttl=64 time=0.112 ms
64 bytes from icmp_seq=4 ttl=64 time=0.104 ms

--- ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2999ms
rtt min/avg/max/mdev = 0.104/0.121/0.152/0.022 ms