0

I have a raspberry pi3 with ubuntu and docker running the following containers

  1. home-assistant
  2. mosquitto
  3. zigbee2mqtt
  4. nodered

this is configured with the following docker-compose yaml:

version: '3.8'

services:
  homeassistant:
    container_name: hass
    image: homeassistant/home-assistant
    volumes:
      - ./hass/configuration.yaml:/config/configuration.yaml
    restart: unless-stopped
    depends_on:
      - mosquitto
    ports:
      - "8123:8123"

  nodered:
    container_name: nodered
    image: nodered/node-red
    ports:
      - "1880:1880"
    volumes:
      - nodered_data:/data
    depends_on:
      - homeassistant
      - mosquitto
    environment:
      TZ: "Europe/Amsterdam"
    restart: unless-stopped

  mosquitto:
    image: eclipse-mosquitto
    container_name: mosquitto
    restart: unless-stopped
    ports:
      - "1883:1883"
    volumes:
      - "./mosquitto/config:/mosquitto/config"
      - "mqtt_data:/mosquitto/data"
      - "./mosquitto/log:/mosquitto/log"
    environment:
      - TZ=Europe/Amsterdam

  zigbee2mqtt:
      container_name: zigbee2mqtt
      image: koenkk/zigbee2mqtt
      restart: unless-stopped
      volumes:
        - "./z2mqtt/data/configuration.yaml:/app/data/configuration.yaml"
        - "z2mqtt:/app/data"
      ports:
        # Frontend port
        - 8080:8080
      environment:
        - TZ=Europe/Amsterdam
      devices:
      #  # Make sure this matched your adapter location
        - "/dev/ttyUSB0:/dev/ttyACM0"
      depends_on:
        - mosquitto

volumes:
  nodered_data:
  mqtt_data:
  z2mqtt:

I have a configuration.yaml for home-assistant with the following content

default_config:

panel_iframe:
  nodered:
    title: Node-Red
    icon: mdi:shuffle-variant
    url: "http://nodered:1880"
    require_admin: true

I can't get the iframe to connect with nodered for some reason. I have tried connecting to the nodered container from an external system using the docker host ip and port 1880, and that works properly. I also tried pinging the 'nodered' container from within the 'hass' container and that works also.

if I replace the iframe url with the docker host ip and port 1880 the iframe does work, however I would rather like to keep the connection within the internal docker network.

Does anyone know how to fix this?

wallage
  • 73
  • 2
  • 6

1 Answers1

0

A little late, but for anyone who stumbles upon this question in the future:

Since the URL inside the iframe is being loaded by your browser, you need to specify an address which is reachable from outside the docker network. Hence you cannot provide the service name as a domain name.

Karnee
  • 1