dns_round_robin_test.md (1221B)
1 # dns rr test 2 3 _note_ 4 use `nslookup search.` with latest alpine image 5 or use older image like `alpine:3.10` 6 7 ## requirements 8 * know host to use `-it` to get shell 9 * understand basics of different distros (ubuntu vs. centos) 10 * know how to run a container 11 * understand basics of dns records 12 13 ## assignment 14 * since docker engine 1.11 we can have multiple containers on a created network respond to the same dns address 15 * create a new virtual network (default bridge driver) 16 * create two containers from `elasticsearch:2` image 17 * research and use `--network-alias search` when creating them to give an additional dns name to respond to 18 * run `alpine nslookup search` with `--net` to see the two containers list for the same dns name 19 * run `centos curl -s search:9200` with `--net` multiple times until you see both "name" fields change 20 21 ## answer 22 ``` 23 --network-alias list Add network-scoped alias for the container 24 ``` 25 26 ``` 27 docker network create search_net 28 docker network ls 29 repeat 2 { docker container run -d --net search_net --network-alias search elasticsearch:2 } 30 docker container run --net search_net -it alpine watch nslookup search. 31 docker container run --net search_net -it centos curl -s search:9200 32 ```