Running HA, AppDaemon, Nginx-Proxy-Manager reverse Proxy using docker-compose file

I want to run the following setup:

  1. Home Assistant in Docker
  2. Nginx-Proxy-Manager in Docker to use a custom domain pointing to my homeassistant instance
  3. Appdaemon in Docker
  4. HA and Appdaemon are running via the same docker-compose.yaml file
  5. nginx-proxy-manager is running using a separate docker-compose.yaml file

Everything works fine except the Appdaemon installation. This is the log of the Appdaemon Initialization:

# appdaemon.log
...
INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
INFO HASS: HASS Plugin Initializing
WARNING HASS: ha_url not found in HASS configuration - module not initialized
INFO HASS: HASS Plugin initialization complete
INFO AppDaemon: Initializing HTTP
INFO AppDaemon: Using 'ws' for event stream
INFO AppDaemon: Starting API
INFO AppDaemon: Starting Admin Interface
INFO AppDaemon: Starting Dashboards
WARNING HASS: Disconnected from Home Assistant, retrying in 5 seconds
...
INFO AppDaemon: Found 10 active apps
INFO AppDaemon: Found 0 inactive apps
INFO AppDaemon: Found 0 global libraries
INFO AppDaemon: Starting Apps with 10 workers and 10 pins
INFO AppDaemon: Running on port 5050
WARNING HASS: Disconnected from Home Assistant, retrying in 5 seconds
WARNING HASS: Disconnected from Home Assistant, retrying in 5 seconds
WARNING HASS: Disconnected from Home Assistant, retrying in 5 seconds
WARNING HASS: Disconnected from Home Assistant, retrying in 5 seconds

It seems like Appdaemon can’t connect to Home Assistant. So maybe I got something wrong in my docker compose file. Especially the part setting the HA_URL and DASH_URL concerns me. As I’m using nginx-proxy-manager as reverse proxy for some of my containers made it difficult to follow official documentation and example setups.

# docker-compose.yaml
version: '3'
services:
  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    volumes:
      - ./config:/config
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped
    privileged: true
    networks:
      - proxy-manager
    environment:
      - VIRTUAL_HOST=mydomain.example
      - VIRTUAL_PORT=8123
    devices:
      - /dev/ttyUSB0:/dev/ttyUSB0

  appdaemon:
    container_name: appdaemon
    restart: unless-stopped
    image: acockburn/appdaemon:latest
    environment:
       # 172.24.0.3 is the local ip of the ha container inside the proxy-manager network
      - HA_URL="https://172.24.0.3:8123"
      - TOKEN="${HA_APPDAEMON_KEY:?error}"
      - DASH_URL="http://172.24.0.3:5050" 
      - TZ=Europe/Berlin
    ports:
      - "5050:5050"
    volumes:
      - ./config/appdaemon:/conf
      - /etc/localtime:/etc/localtime:ro
    networks:
      - proxy-manager
    depends_on:
      - homeassistant

networks:
  proxy-manager:
    name: nginx-proxy-manager_default
    external: true

For the sake of completeness the appdaemon.yaml file inside the config folder:

# appdaemon.yaml

appdaemon:
  latitude: xx.xx
  longitude: xx.xx
  elevation: xxx
  time_zone: Europe/Berlin
  plugins:
    HASS:
      type: hass
http:
  url: "http://172.24.0.3:5050"
admin:
api:
hadashboard:
logs:
  main_log:
    filename: /conf/logs/appdaemon.log

Can anyone spot where I might have made a mistake? Any help is welcome.