From a7ae12d297a358da3d04ebda2ccdf43ba85d5a49 Mon Sep 17 00:00:00 2001 From: vithobaa Date: Mon, 29 Jun 2026 18:51:57 +0530 Subject: [PATCH] fix: explicit docker network for rock solid DNS resolution Completely removes the Nginx resolver hack. By assigning all services to a dedicated custom bridge network ('autopilot-net') and relying on docker-compose 'depends_on', Docker's internal DNS is guaranteed to resolve the 'autopilot-master' hostname cleanly at Nginx startup without SERVFAILs. --- docker-compose.yml | 13 +++++++++++++ ui/nginx.conf | 6 +----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index ca13bd8..5e512fc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,6 +18,8 @@ services: interval: 10s timeout: 5s retries: 5 + networks: + - autopilot-net # ─── AutoPilot Master (Cloud Coordinator Backend) ───────────────────────── master: @@ -42,6 +44,8 @@ services: postgres: condition: service_healthy restart: unless-stopped + networks: + - autopilot-net # ─── AutoPilot UI (React Frontend via Nginx) ─────────────────────────────── ui: @@ -56,6 +60,8 @@ services: depends_on: - master restart: unless-stopped + networks: + - autopilot-net # ─── AutoPilot Worker (Execution Engine) ────────────────────────────────── # NOTE: The worker needs access to a real browser (Chrome/Firefox). @@ -74,6 +80,13 @@ services: # depends_on: # - master # restart: unless-stopped + # networks: + # - autopilot-net + +networks: + autopilot-net: + driver: bridge volumes: postgres_data: + diff --git a/ui/nginx.conf b/ui/nginx.conf index f33052e..d8302de 100644 --- a/ui/nginx.conf +++ b/ui/nginx.conf @@ -5,10 +5,6 @@ server { # Allow large request bodies (screenshots are base64 encoded) client_max_body_size 50M; - # Use Docker's internal DNS resolver (disable IPv6 to prevent SERVFAIL) - resolver 127.0.0.11 ipv6=off valid=30s; - set $backend http://master:9090; - # Serve static files from the React build location / { root /usr/share/nginx/html; @@ -18,7 +14,7 @@ server { # Reverse proxy API requests to the Master backend container location /api/ { - proxy_pass $backend; + proxy_pass http://autopilot-master:9090; # Standard proxy headers proxy_set_header Host $host;