• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[INFO]Docker DNS server
#1
I want to highlight a Docker feature that is very useful in case you spread your applications among multiple containers: Docker features an embedded DNS server in case you use USER-DEFINED BRIDGED NETWORKS.

The problem:

Often spread containers need to talk to each other over http, ftp, mqtt and others over TCP/IP directed channels. Whenever containers are deployed and operated in default bridged-network mode they get an IP address such as 172.17.0.2 or 172.17.0.3 and so on automatically. The problem now is that the IP address assigned is not constant and may vary each time a docker host platform like netPI is repowered and the containers a restarted. So if a container application then wants to talk to any other container over a set and fixed IP address this will lead sooner or later to a problem in case the destination IP address is getting different during reboot times.

The solution:

The problem can be solved if instead of ip addressing scheme a name adressing scheme is used supported by the Docker embedded DNS server. The best of it is that you do not need to define any extra name ... just using the container's name is enough to address it. For example if you named a container mosquitto then you can just call ping mosquitto from any other container and you get response. Or supposing you started an influxdb database container named influxdb supporting a REST API over port 8086 then simply address it with http://influxdb:8086.

There is one thing you need to consider: the embedded DNS server works in user-defined bridged networks only and not with the default bridge network (cause of compatibility reasons) as explained on the official Docker web site here. So you have to create an own network first as the picture illustrates:

   

Later before you deploy your containers you have to select your user-defined network instead of the default bridge to let them participating this network

   

Thx
Armin
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  https certificate issues in new nodered docker image Dipro 1 1,643 May-4th-2022, 05:46 AM
Last Post: Armin@netPI
  netPI opc ua server pull image error wswitula 3 3,080 August-27th-2021, 10:47 AM
Last Post: wswitula
  OPC UA server with NetPi RTE DSongra 9 4,133 July-27th-2021, 12:01 PM
Last Post: Armin@netPI
  REST API server data communication MGharat 2 2,416 July-21st-2021, 07:01 AM
Last Post: MGharat
  Docker exposed port don't send data on eth0 COswald 3 3,075 July-15th-2021, 02:10 PM
Last Post: Armin@netPI
  Docker not enabled tad 10 4,758 July-14th-2021, 08:54 AM
Last Post: Armin@netPI
  [SOLVED]DHCP server not working m-yoshikawa 24 13,449 June-11th-2021, 07:04 AM
Last Post: tad
  Docker amd64 instead of arm biancode 3 2,971 January-17th-2021, 09:40 PM
Last Post: Armin@netPI
  docker.service start failed EUROKEY 13 9,080 January-17th-2021, 07:52 PM
Last Post: Armin@netPI
  Docker cannot find image COswald 16 8,772 May-18th-2020, 07:15 AM
Last Post: COswald

Forum Jump:


Users browsing this thread: 1 Guest(s)