[SOLVED] Docker with OpenHab in host network, and node-red in bridge - advise needed

  • Platform information:
    • Hardware: Intel laptop, 2gb ram
    • OS: Ubuntu server 18
    • Java Runtime Environment: docker
    • openHAB version: 2.4 docker
  • Issue of the topic:

I have openhab in docker set on host network, all working fine, it is reachable via ip I also have several dockers that should communicate with openhab, f.eks. mosquitto and node-red. Other docker containers are in bridged network, and they can access openhab by using in their config.
However, this is depending on my router and entire network infrastructure, and is getting in a way when I try to f.eks. restart router, then node-red cannot communicate with openhab even though they are on the same physical machine.
I imagine it would be possible to use some other docker network/functionality, or some other way of reaching openhab connected to host network, from other docker containers connected on a bridged network. (I tried adding openhab to common docker network, but since it is connected to host network, it cannot be to both)
Anyone knows how to achieve this? Or at least what to google for? I can imagine this being “common” situation since openhab is advised to use host network (for auto-discovery etc)

After some googling I think I got it right that linux (or only linux docker) does not have default host, so I used default docker gateway/host ip.
In node-red I use to get to openhab, and it works so far… I will see how it behaves down the road