Contenu connexe Similaire à Weave Networking on Docker Similaire à Weave Networking on Docker (20) Weave Networking on Docker2. Docker Networking
• Linux Bridge based
• Work as this:
• Creates a Virtual Eth Bridge on docker0
• Assign docker0 bridge an IP unused on host
• create a vethXXXX interface
• map vethXXXX to ethX on host
5. Docker networking
host1
wordpress
docker0
mysql
eth0
Container Interconnection through docker0
That’s how container linking works:
exporting host information in local ENV
Container communicate
through open ports
$docker run -d
--name mysql
-e MYSQL_DATABASE=WORDPRESS
-e MYSQL_USER=wp
-e MYSQL_PASSWORD=huhu
orchardup/mysql
$docker run
--name wordpress
--link mysql:mysql -d
-e WORDPRESS_DB_USER=wp
-e WORDPRESS_DB_NAME=WORDPRESS
-e WORDPRESS_DB_PASSWORD=huhu
wordpress
vethXXX
vethXXX
eth0eth0
6. Docker networking
host1
wordpress mysql
eth0
Container exposing public port
docker0
$docker run -d
--name mysql
-e MYSQL_DATABASE=WORDPRESS
-e MYSQL_USER=wp
-e MYSQL_PASSWORD=huhu
orchardup/mysql
$docker run
--name wordpress
--link mysql:mysql -d
-e WORDPRESS_DB_USER=wp
-e WORDPRESS_DB_NAME=WORDPRESS
-e WORDPRESS_DB_PASSWORD=huhu
-p 80:80
wordpress
$sudo docker exec -it wordpress bash
:80
vethXXX
vethXXX
eth0eth0
7. Weave
• Allows containers to all behave as if
they were connected to the same
physical network switch
• Connectivity to outside world
11. Weave network
e
weave
router
e
weave
router
eth0
host 1 host 2
container1 container2
$weave launch
$weave run 10.0.1.1/24 -d
—name container1 ubuntu /bin/bash
$nc -lk -p 4422
weave launch 10.0.1.1
weave run 10.0.1.2/24 -d
—name container2 ubuntu /bin/bash
echo 'Hello, world.' | nc 10.0.1.1 4422
13. Demo
• Launching 3 VMs
• Installing weave on each
• Launching weave router
• Launching containers with weave
• Dynamically attaching a container to
weave