• 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


Messages In This Thread
Answer - by Armin@netPI - December-4th-2017, 07:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  REST API server data communication MGharat 2 2,440 July-21st-2021, 07:01 AM
Last Post: MGharat
  TOSILOCK for CONTAINER COswald 3 2,182 July-13th-2021, 11:32 AM
Last Post: Armin@netPI
  communication cycle as EtherCAT slave tad 2 2,113 April-20th-2021, 11:14 AM
Last Post: tad
  Access to RTC from my own container application tad 1 3,519 March-19th-2021, 02:58 PM
Last Post: Armin@netPI
  [SOLVED] Starting services/commands/scripts at startup of a container Jonas.Sellmann@outlook.de 9 6,011 March-9th-2021, 08:47 AM
Last Post: WalterSchaefer
  OpenVPN container Armin@netPI 0 1,612 January-3rd-2021, 12:13 PM
Last Post: Armin@netPI
  operating Console of a container on netPI connected to Wi-Fi tethering tad 3 2,611 December-3rd-2020, 12:32 PM
Last Post: tad
  NIOT-E-NPIX-4DI4DO with netpi-netx container WalterSchaefer 3 6,471 November-25th-2020, 01:06 PM
Last Post: zen89
  NPIX-4DI4DO and NetPi-Nodered container issues alhammi 4 7,581 November-16th-2020, 01:35 PM
Last Post: alhammi
  Get host MAC via REST API inside container bschandra 4 3,640 November-16th-2020, 09:26 AM
Last Post: bschandra

Forum Jump:


Users browsing this thread: 1 Guest(s)