docker: UI not reachable

So I tried to do a fresh restart using following docker-compose.yml which has worked for me before:

services:
  openems-edge:
    #image: openems/edge:latest
    image: openems/edge:develop
    container_name: openems_edge
    hostname: openems_edge
    restart: unless-stopped
    volumes:
      - openems-edge-conf:/var/opt/openems/config:rw
      - openems-edge-data:/var/opt/openems/data:rw
    ports:
      - 8080:8080 # Apache-Felix
      - 8085:8085 # UI-Websocket

  openems-ui:
    #image: openems/ui-edge:latest
    image: openems/ui-edge:develop
    container_name: openems_ui
    hostname: openems_ui
    restart: unless-stopped
    volumes:
      - openems-ui-conf:/etc/nginx:rw
      - openems-ui-log:/var/log/nginx:rw
    environment:
      - UI_WEBSOCKET=ws://test-openems.example.com:8085
    ports:
      - 80:80
      - 443:443

  openems_influxdb:
    image: influxdb:alpine
    container_name: openems_influxdb
    hostname: openems_influxdb
    restart: unless-stopped
    volumes:
      - openems-influxdb:/var/lib/influxdb2:rw
    ports:
      - 8086:8086

volumes:
  openems-edge-conf:
  openems-edge-data:
  openems-ui-conf:
  openems-ui-log:
  openems-influxdb:

I used docker compose pull and docker compose up -d. I can reach the Felix console, but not the UI. Ping is fine, but nmap shows a closed port 80. docker compose logs for the UI outputs:

openems_ui        | [migrations] started
openems_ui        | [migrations] no migrations found
openems_ui        | usermod: no changes
openems_ui        | ───────────────────────────────────────────
openems_ui        |  _____ _____ _____ _____ _____ _____ _____ 
openems_ui        | |     |  _  |   __|   | |   __|     |   __|
openems_ui        | |  |  |   __|   __| | | |   __| | | |__   |
openems_ui        | |_____|__|  |_____|_|___|_____|_|_|_|_____|
openems_ui        | 
openems_ui        |         OpenEMS UI for edge devices
openems_ui        |     Based on images from linuxserver.io
openems_ui        | ───────────────────────────────────────────
openems_ui        | for further information visit:
openems_ui        | https://openems.io/
openems_ui        | 
openems_ui        | ───────────────────────────────────────
openems_ui        | GID/UID:    911/911
openems_ui        | ───────────────────────────────────────
openems_ui        | sending incremental file list
openems_ui        | ./
openems_ui        | dhparams.pem
openems_ui        | openems-nginx.conf
openems_ui        | site-confs/
openems_ui        | site-confs/443-openems.conf.tpl
openems_ui        | site-confs/80-openems.conf.tpl
openems_ui        | snippets/
openems_ui        | snippets/ssl-cert.conf
openems_ui        | snippets/ssl.conf
openems_ui        | 
openems_ui        | sent 7,082 bytes  received 149 bytes  14,462.00 bytes/sec
openems_ui        | total size is 6,564  speedup is 0.91
openems_ui        | 
openems_ui        | WEBSOCKET_HOST contains <hostname> placeholder, replace it with the actual hostname or IP address of the Docker host.

I’m puzzled especially about the last line. Additional info, Felix shows:

@da-Kai Do you have an idea what I missed? :slight_smile:

Du hast:

environment:
  - UI_WEBSOCKET=ws://test-openems.example.com:8085

β†’ Der Container weiß nichts ΓΌber test-openems.example.com.
Das ist ein externer DNS-Name, den dein Container nicht kennt (weil er im internen Docker-Netz lΓ€uft).
Wenn du nmap machst und Port 80 β€žclosedβ€œ siehst, dann liegt das daran, dass nginx gar nicht gestartet wurde, weil das Entry-Script vorher abgebrochen ist (durch diese Warnung).

Deswegen auch:

replace it with the actual hostname or IP address of the Docker host.

Verwende die interne Netzwerk-Adresse oder Host-IP, z. B.:

environment:
  - UI_WEBSOCKET=ws://openems_edge:8085

oder – falls du von außen (Host-Browser) aufrufst – die Host-IP:

environment:
  - UI_WEBSOCKET=ws://<DEINE_HOST_IP>:8085

(z. B. ws://192.168.178.145:8085 oder ws://localhost:8085)

Sorry @sjjh i broke your setup, with my latest PR. instead of the UI_WEBSOCKET evironment variable, use the β€œWEBSOCKET_HOSTβ€œ and β€œWEBSOCKET_PORT” variables.
see: Improve UI docker by da-Kai Β· Pull Request #3366 Β· OpenEMS/openems Β· GitHub

2 Likes