mirror of
https://github.com/UNITRONIX/BetterDesk.git
synced 2026-09-10 09:35:39 +00:00
Fix port 21121 connection refused in Docker (API_HOST binding)
Root cause: config.js defaults apiHost to 127.0.0.1 (localhost-only). Inside Docker containers, this means port 21121 only listens on the loopback interface, making it unreachable from outside the container despite docker port mapping. docker-compose.single.yml already had API_HOST=0.0.0.0, but docker-compose.yml (multi-container) and docker-compose.quick.yml (GHCR pre-built) were missing it. Fixes: - docker-compose.yml: Add HOST=0.0.0.0 and API_HOST=0.0.0.0 - docker-compose.quick.yml: Add HOST=0.0.0.0 and API_HOST=0.0.0.0 - Dockerfile.console: Add ENV API_HOST=0.0.0.0 - Dockerfile (single): Add ENV API_HOST=0.0.0.0 - docker/entrypoint.sh: Export API_HOST and HOST defaults - docker/supervisord.conf: Add API_HOST and HOST to console env Fixes #78
This commit is contained in:
@@ -100,6 +100,7 @@ ENV NODE_ENV=production
|
||||
ENV PORT=5000
|
||||
ENV SIGNAL_PORT=21116
|
||||
ENV HOST=0.0.0.0
|
||||
ENV API_HOST=0.0.0.0
|
||||
ENV DATA_DIR=/app/data
|
||||
ENV RUSTDESK_PATH=/opt/rustdesk
|
||||
ENV DB_PATH=/opt/rustdesk/db_v2.sqlite3
|
||||
|
||||
@@ -56,6 +56,7 @@ RUN mkdir -p /app/data /opt/rustdesk && \
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=5000
|
||||
ENV HOST=0.0.0.0
|
||||
ENV API_HOST=0.0.0.0
|
||||
ENV DATA_DIR=/app/data
|
||||
ENV RUSTDESK_PATH=/opt/rustdesk
|
||||
ENV DB_PATH=/app/data/db_v2.sqlite3
|
||||
|
||||
@@ -60,6 +60,8 @@ services:
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- PORT=5000
|
||||
- HOST=0.0.0.0
|
||||
- API_HOST=0.0.0.0
|
||||
- SERVER_BACKEND=betterdesk
|
||||
- BETTERDESK_API_URL=http://betterdesk-server:21114/api
|
||||
- RUSTDESK_PATH=/opt/rustdesk
|
||||
|
||||
@@ -66,6 +66,8 @@ services:
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- PORT=5000
|
||||
- HOST=0.0.0.0
|
||||
- API_HOST=0.0.0.0
|
||||
- SERVER_BACKEND=betterdesk
|
||||
- HBBS_API_URL=http://betterdesk-server:21114/api
|
||||
- BETTERDESK_API_URL=http://betterdesk-server:21114/api
|
||||
|
||||
@@ -79,6 +79,10 @@ fi
|
||||
# Ensure Go server uses correct signal port (not NODE.js PORT)
|
||||
export SIGNAL_PORT="${SIGNAL_PORT:-21116}"
|
||||
|
||||
# Ensure Node.js Client API binds to all interfaces (not just localhost)
|
||||
export API_HOST="${API_HOST:-0.0.0.0}"
|
||||
export HOST="${HOST:-0.0.0.0}"
|
||||
|
||||
# Relay server address: if not explicitly set, try to auto-detect public IP.
|
||||
# Inside Docker, the Go server's own detection may return the container's
|
||||
# internal IP (172.x.x.x) which is unreachable by remote clients.
|
||||
|
||||
@@ -56,4 +56,6 @@ stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
; Ensure Client API binds to all interfaces inside container
|
||||
environment=API_HOST="0.0.0.0",HOST="0.0.0.0"
|
||||
priority=200
|
||||
|
||||
Reference in New Issue
Block a user