• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inter-container communication with help of DNS
#1
Docker automatically assigns IP adresses to all those containers started in default bridged network mode. A disadvantage is that each time netPI boots different IP addresses are assigned to these containers which makes a predicable inter-container communication impossible.
Instead is it recommended to create a local user-defined network on the system first where Docker is automatically operating a DNS service for. Then, in case a container is started, you can specify this user-defined network as network the container shall run with.
The embedded DNS server provides the discovery service for any container created with a valid name. Only then it maintains the mapping between the container name and its IP address on the network the container is connected to.
Example: Create two containers with names Container1 and Container2. For both containers specify your user-defined network to connect to. A DNS service will be provided automatically on this network. You can then address the containers over their names with a ping command for example like ping Container1 or ping Container2 instead of using their IP addresses.
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  [SOLVED] activate LED1/2 with Node-RED + fieldbus nodes container Christian_Rau 6 93 October-21st-2019, 10:30 AM
Last Post: Armin@netPI
  Cannot start container Magnus 7 41 October-16th-2019, 01:00 PM
Last Post: Armin@netPI
  Generate VLAN interfaces in container FrankJacob 7 46 September-26th-2019, 03:19 PM
Last Post: Armin@netPI
  create container in Portainer v1.12.4 dcatteeu 2 24 September-9th-2019, 12:12 PM
Last Post: dcatteeu
  UMTS/LTE support via USB router/modem sticks in a container Armin@netPI 3 157 September-5th-2019, 02:07 PM
Last Post: Armin@netPI
  Exporting and importing container images Armin@netPI 0 27 August-23rd-2019, 10:39 AM
Last Post: Armin@netPI
  Ready-to-deploy: full featured Node-RED container Armin@netPI 5 80 July-25th-2019, 06:16 AM
Last Post: Armin@netPI
  New Container example "OPC UA server" Armin@netPI 0 25 April-12th-2019, 11:51 AM
Last Post: Armin@netPI
  Official Node-RED container Armin@netPI 0 20 April-5th-2019, 10:39 AM
Last Post: Armin@netPI
  Multi-stage builds for slim container images Armin@netPI 0 10 February-7th-2019, 04:14 PM
Last Post: Armin@netPI

Forum Jump:


Users browsing this thread: 1 Guest(s)