This is an automated email from the ASF dual-hosted git repository.

lizhimins pushed a commit to branch rocketmq-studio
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git


The following commit(s) were added to refs/heads/rocketmq-studio by this push:
     new 7e11ad70 fix(deploy): bootstrap local docker compose on Docker Engine 
(#1197)
7e11ad70 is described below

commit 7e11ad70f3978514b18b6ac3107ca4c2aaaf3f68
Author: Lei Zhiyuan <[email protected]>
AuthorDate: Mon Aug 10 14:04:23 2026 +0800

    fix(deploy): bootstrap local docker compose on Docker Engine (#1197)
    
    * fix(rocketmq): declare subnet for compose network static IPs
    
    broker-0/broker-1/nameserver/proxy pin static IPs (10.89.2.x) but the
    default network had no ipam subnet, so 'docker compose up' failed with
    'user specified IP address is supported only when connecting to networks
    with user configured subnets' on Docker Engine. Declare a 10.89.2.0/24
    bridge subnet so the pinned addresses match.
    
    * fix(web): use Docker embedded DNS for nginx upstream resolver
    
    15-resolver.envsh derived the nginx resolver from the default gateway,
    which is only valid under podman. On Docker Engine the gateway IP runs no
    DNS server, so resolving the rocketmq-server upstream failed and every
    /api/ request returned 502 ('could not be resolved', Operation timed out),
    breaking login status checks. Prefer Docker's embedded DNS at 127.0.0.11
    and fall back to the gateway only when it is unreachable.
    
    ---------
    
    Co-authored-by: zhiyuanlei <[email protected]>
---
 deploy/rocketmq/docker-compose.yml |  4 ++++
 web/15-resolver.envsh              | 19 +++++++++++++------
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/deploy/rocketmq/docker-compose.yml 
b/deploy/rocketmq/docker-compose.yml
index 1393c6f8..8b83e683 100644
--- a/deploy/rocketmq/docker-compose.yml
+++ b/deploy/rocketmq/docker-compose.yml
@@ -120,6 +120,10 @@ services:
 networks:
   default:
     name: rocketmq_default
+    driver: bridge
+    ipam:
+      config:
+        - subnet: 10.89.2.0/24
 
 volumes:
   broker-0-store:
diff --git a/web/15-resolver.envsh b/web/15-resolver.envsh
index 8f802676..ed04a8dc 100755
--- a/web/15-resolver.envsh
+++ b/web/15-resolver.envsh
@@ -1,11 +1,18 @@
 #!/bin/sh
 # Sourced by docker-entrypoint.sh (*.envsh), so RESOLVER is visible to the
-# later 20-envsubst-on-templates.sh step. Uses the podman network gateway
-# (the container DNS server) only — the host resolv.conf may leak public DNS
-# servers that cannot resolve container names and cause random 502s.
-RESOLVER="$(ip route | awk '/default/ {print $3; exit}')"
-if [ -z "$RESOLVER" ]; then
-    RESOLVER="127.0.0.11"
+# later 20-envsubst-on-templates.sh step.
+#
+# Prefer Docker's embedded DNS (127.0.0.11): it resolves container names and
+# is the correct choice on Docker Engine. Fall back to the default gateway
+# (podman's container DNS server) only when 127.0.0.11 is unreachable.
+# The host resolv.conf may leak public DNS servers that cannot resolve
+# container names and cause random 502s, so never use it directly.
+RESOLVER="127.0.0.11"
+if ! nc -z -w2 127.0.0.11 53 >/dev/null 2>&1; then
+    GW="$(ip route | awk '/default/ {print $3; exit}')"
+    if [ -n "$GW" ]; then
+        RESOLVER="$GW"
+    fi
 fi
 export RESOLVER
 echo "15-resolver.envsh: resolver=$RESOLVER"

Reply via email to