Node-RED in docker but using Host Networking Mode

I have previous attempts of Home Assistant where HA would NOT detect various IoT devices that broadcast their availability. The problem in that scenario was that docker does not pass the IoT broadcast messages on through the bubble.

The only method to get HA to work with IoT devices was to install HA in docker in host networking mode which made the container appear on the host network as if directly attached.

I am assuming that Node-RED is the same way and that it won't detect my IoT device broadcasts unless I install it in host networking mode.

Sounds pretty straight forward.... but node-red no longer responds on port 1880 when I have it in host mode.

I just commented out the port section of the compose file and made it host mode instead. This should be a no-brainer.

Anyone know what I am doing wrong?

version: "3.7"
services:
  node-red:
    image: nodered/node-red:latest
    environment:
      - TZ="America/New_York"
    network_mode: host
    volumes:
      - node-red-data:/data

volumes:
  node-red-data:

It should work. Have you changed

uiPort: process.env.PORT || 1880,

in settings.js?

I haven't edited the settings file at all.

It works if I leave the container on an internal network and use standard port settings in the compos file. It works but I am pretty sure the 'system' won't work that way due to lack of IoT broadcast messages being received.

Oh, I am using Windows and "Docker Desktop" if that matters.

I was hoping to not have to create a new VM just to host docker.

i think indeed its because you are using Docker Desktop on Windows
Read this Github issue open since 2021 :wink:
Support Host Network (--network host) mode on Docker Desktop

2 Likes

Uhg, windows limitations.

Thanks.

I have one single app that needs to run in Windows and it causes all of these problems for me.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.