fix: UI containers use --network host for localhost proxy access

Bitcoin UI and Electrs UI proxy API calls to 127.0.0.1 services
(Bitcoin RPC on 8332, backend on 5678). With port-mapped containers,
127.0.0.1 is the container's own localhost — the proxy fails and UIs
show "Unable to connect to Bitcoin node".

Fix: bitcoin-ui and electrs-ui use --network host (internal ports
8334 and 50002 don't conflict with host nginx on 80/443). LND UI
stays port-mapped (-p 8081:80) because port 80 would conflict.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dorian 2026-04-01 22:18:00 +01:00
parent 9a1edfb377
commit 1b3a3f401b

View File

@ -988,9 +988,12 @@ for ui in bitcoin-ui lnd-ui; do
continue
fi
case $ui in
bitcoin-ui) PORT_ARG="-p 8334:8334"; NET_ARG="" ;; # internal nginx listens on 8334
lnd-ui) PORT_ARG="-p 8081:80"; NET_ARG="" ;;
electrs-ui) PORT_ARG="-p 50002:50002"; NET_ARG="" ;; # internal nginx listens on 50002
# UI containers use --network host so they can proxy to localhost services
# (Bitcoin RPC at 127.0.0.1:8332, backend at 127.0.0.1:5678)
# Internal nginx ports: bitcoin-ui=8334, electrs-ui=50002, lnd-ui=80 (mapped via nginx to 8081)
bitcoin-ui) PORT_ARG=""; NET_ARG="--network host" ;;
lnd-ui) PORT_ARG="-p 8081:80"; NET_ARG="" ;; # exception: port 80 conflicts with host nginx on host network
electrs-ui) PORT_ARG=""; NET_ARG="--network host" ;;
esac
CONTAINER_NAME="archy-$ui"
if $DOCKER images --format '{{.Repository}}:{{.Tag}}' 2>/dev/null | grep -q "$ui"; then