Friday, July 13, 2018

Part 1: Docker networking domain sharing

Take a look at this test yaml file.

ubuntu@ip-172-31-11-243:~$ cat alipapa.yml
version: "3.5"
services:
  ali01:
    image: ubuntu:16.04
    hostname: ali01
    container_name: ali01
    domainname: papa.com
    networks:
      papa.com:
        aliases:
          - ali01.papa.com
    entrypoint: sleep infinity
  ali02:
    image: ubuntu:16.04
    hostname: ali02
    container_name: ali02
    domainname: papa.com
    networks:
      papa.com:
        aliases:
          - ali02.papa.com
    entrypoint: sleep infinity
networks:
  papa.com:
    driver: bridge

When you are bringing up all these containers, considering that you tap into ali01 and ping ali02, what is your expected result.

ubuntu@ip-172-31-11-243:~$ docker-compose -f alipapa.yml up -d
Creating network "ubuntu_papa.com" with driver "bridge"
Creating ali02 ... done
Creating ali01 ... done
ubuntu@ip-172-31-11-243:~$ docker ps -a
CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS                       PORTS               NAMES
fdbfb1a48686        ubuntu:16.04           "sleep infinity"         7 seconds ago       Up 6 seconds                                     ali02
7566e8c7db8b        ubuntu:16.04           "sleep infinity"         7 seconds ago       Up 5 seconds                                     ali01

ubuntu@ip-172-31-11-243:~$ docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
07cb97e27689        bridge              bridge              local
e81946364c3d        host                host                local
b285c6c7236e        none                null                local
5fb1bdc9f13e        ubuntu_papa.com     bridge              local

Wait... I didn't actually creating ubuntu_papa.com domain? Why it is so? Should it be just papa.com?

root@ali01:/# ping ali02
PING ali02 (172.20.0.3) 56(84) bytes of data.
64 bytes from ali02.ubuntu_papa.com (172.20.0.3): icmp_seq=1 ttl=64 time=0.087 ms
64 bytes from ali02.ubuntu_papa.com (172.20.0.3): icmp_seq=2 ttl=64 time=0.053 ms
64 bytes from ali02.ubuntu_papa.com (172.20.0.3): icmp_seq=3 ttl=64 time=0.062 ms

root@ali01:/# ping ali02.papa.com
PING ali02.baba.com (172.20.0.3) 56(84) bytes of data.
64 bytes from ali02.ubuntu_papa.com (172.20.0.3): icmp_seq=1 ttl=64 time=0.063 ms
64 bytes from ali02.ubuntu_papa.com (172.20.0.3): icmp_seq=2 ttl=64 time=0.061 ms
64 bytes from ali02.ubuntu_papa.com (172.20.0.3): icmp_seq=3 ttl=64 time=0.065 ms

Scratching head moment. 😓😓😓




3 comments:

Mounika said...

Some us know all relating to the compelling medium you present powerful steps on this blog and therefore strongly encourage contribution from other ones on this subject while our own child is truly discovering a great deal. Have fun with the remaining portion of the year.
python training in pune | python training institute in chennai | python training in Bangalore

Unknown said...

I appreciate that you produced this wonderful article to help us get more knowledge about this topic. I know, it is not an easy task to write such a big article in one day, I've tried that and I've failed. But, here you are, trying the big task and finishing it off and getting good comments and ratings. That is one hell of a job done!

java training in jayanagar | java training in electronic city

java training in chennai | java training in USA

shiny said...

I found this informative and interesting blog so i think so its very useful and knowledge able.I would like to thank you for the efforts you have made in writing this article.




web designing training in chennai

web designing training in annanagar

digital marketing training in chennai

digital marketing training in annanagar

rpa training in chennai

rpa training in annanagar

tally training in chennai

tally training in annanagar