|
| 1 | +The multi node container networking can be tested on a single VM by running docker inside docker. |
| 2 | +https://blog.docker.com/2013/09/docker-can-now-run-within-docker/ |
| 3 | + |
| 4 | +The outside docker containers act like physical hosts in our test and are connected using a standard linux bridge. Inside each "host container" we run a namespaced instance of docker, OVS , etcd and netplugin instance. One can now launch containers from within each "host containers" and use netplugin networking to connect them. |
| 5 | + |
| 6 | +Prerequisites |
| 7 | +------------- |
| 8 | +The following needs to be installed on the host machine |
| 9 | +1. Docker |
| 10 | +2. nsenter (Pls see https://github.com/jpetazzo/nsenter) |
| 11 | +3. Bridge utils |
| 12 | +``` |
| 13 | + apt-get install bridge-utils |
| 14 | +```` |
| 15 | +
|
| 16 | +Step to launch docker hosts are : |
| 17 | +-------------------------------- |
| 18 | +``` |
| 19 | + make build |
| 20 | + CONTINV_NODES=2 make start-dockerdemo |
| 21 | +``` |
| 22 | +
|
| 23 | +This will start CONTIV_NODES number of containers with docker image called ubuntu_netplugin which is just ubuntu image with docker, etcd and ovs installed. |
| 24 | +
|
| 25 | +Now start a shell within any of the "host containers" using following convenience wrapper around nsenter : |
| 26 | +``` |
| 27 | +scripts/dockerhost/docker-sh netplugin-node<x> |
| 28 | +``` |
| 29 | +
|
| 30 | +Start netplugin, post netplugin config and launch containers inside the "host containers" the same way you do on VMs. |
| 31 | +Note : currently the demo is working only if config is posted before containers are started .. need to debug why the reverse is not working. |
| 32 | +
|
| 33 | +To cleanup all the docker hosts and the virtual interfaces created do |
| 34 | + ``` |
| 35 | + make cleanup-dockerdemo |
| 36 | + ``` |
| 37 | + |
| 38 | +Example for testing TwoHostMultiVlan you can do : |
| 39 | +
|
| 40 | +1. Launch the two host containers |
| 41 | +
|
| 42 | + ``` |
| 43 | + export CONTIV_NODES=2 |
| 44 | + make start-dockerdemo |
| 45 | + ``` |
| 46 | +
|
| 47 | +2. Load the netplugin configuration |
| 48 | + ``` |
| 49 | + docker-sh netplugin-node1 |
| 50 | + /netplugin/bin/netdcli -cfg /netplugin/examples/two_hosts_multiple_vlans_nets.json |
| 51 | + ``` |
| 52 | + |
| 53 | +3. Launch container1 on host1 |
| 54 | + |
| 55 | + ``` |
| 56 | + docker-sh netplugin-node1 |
| 57 | + docker run -it --name=myContainer1 --hostname=myContainer1 ubuntu /bin/bash |
| 58 | + ``` |
| 59 | + |
| 60 | +4. Launch container3 on host2 |
| 61 | +
|
| 62 | + ``` |
| 63 | + docker-sh netplugin-node2 |
| 64 | + docker run -it --name=myContainer3 --hostname=myContainer1 ubuntu /bin/bash |
| 65 | + ``` |
| 66 | +
|
| 67 | +5. Test connectivity between the containers using ping. Go to the shell for container1 |
| 68 | + ``` |
| 69 | + root@myContainer1:/# ping -c3 11.1.2.2 |
| 70 | +PING 11.1.2.2 (11.1.2.2) 56(84) bytes of data. |
| 71 | +64 bytes from 11.1.2.2: icmp_seq=1 ttl=64 time=3.15 ms |
| 72 | +64 bytes from 11.1.2.2: icmp_seq=2 ttl=64 time=1.36 ms |
| 73 | + ``` |
| 74 | +
|
0 commit comments