• 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
  [INFO] CODESYS V3.5.15.0 compatibility confirmed Armin@netPI 5 33 October-13th-2019, 08:56 PM
Last Post: Armin@netPI
  [SOLVED] Docker GUI login issue MGharat 1 24 September-19th-2019, 11:50 AM
Last Post: Armin@netPI
Information netPI Docker REST API for versions >= V1.1.4.0 patrick 1 82 July-16th-2019, 02:45 PM
Last Post: patrick
  [SOLVED] Pull Docker Image a.w.d.m. 8 38 July-8th-2019, 11:17 AM
Last Post: Armin@netPI
  [SOLVED] Docker issues AlexRegev 7 193 June-26th-2019, 02:14 PM
Last Post: AlexRegev
  docker timing MGharat 2 34 June-13th-2019, 08:57 AM
Last Post: patrick
  Launching multi-containers at a time - Docker stacks Armin@netPI 0 36 June-4th-2019, 04:11 PM
Last Post: Armin@netPI
  New Container example "OPC UA server" Armin@netPI 0 17 April-12th-2019, 11:51 AM
Last Post: Armin@netPI
  [SOLVED] node-red Dashboard Docker Image for netPI? anrodriguez 1 26 February-7th-2019, 05:35 PM
Last Post: Armin@netPI
  [INFO] CODESYS V3.5.14.0 compatibility confirmed Armin@netPI 0 21 February-6th-2019, 01:20 PM
Last Post: Armin@netPI

Forum Jump:


Users browsing this thread: 1 Guest(s)