From 13664e99e7dae7a7eca88f548ff4d00a8716f37a Mon Sep 17 00:00:00 2001 From: Gao Mingfei Date: Thu, 9 Apr 2026 15:58:30 +0800 Subject: [PATCH] fix(docker): nginx fails to start on hosts without IPv6 (#2027) * fix(docker): nginx fails to start on hosts without IPv6 - Detect IPv6 support at runtime and remove `listen [::]` directive when unavailable, preventing nginx startup failure on non-IPv6 hosts - Use `exec` to replace shell with nginx as PID 1 for proper signal handling (graceful shutdown on SIGTERM) - Reformat command from YAML folded scalar to block scalar (no functional change) Co-Authored-By: Claude Opus 4.6 * fix(docker): harden nginx startup script (Copilot review feedback) Add `set -e` so envsubst failures exit immediately instead of starting nginx with an incomplete config. Narrow the sed pattern to match only the `listen [::]:2026;` directive to avoid accidentally removing future lines containing [::]. Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: Claude Opus 4.6 --- docker/docker-compose-dev.yaml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docker/docker-compose-dev.yaml b/docker/docker-compose-dev.yaml index 02552e49f..c2a91ee9f 100644 --- a/docker/docker-compose-dev.yaml +++ b/docker/docker-compose-dev.yaml @@ -69,10 +69,15 @@ services: environment: - LANGGRAPH_UPSTREAM=${LANGGRAPH_UPSTREAM:-langgraph:2024} - LANGGRAPH_REWRITE=${LANGGRAPH_REWRITE:-/} - command: > - sh -c "envsubst '$$LANGGRAPH_UPSTREAM $$LANGGRAPH_REWRITE' - < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf - && nginx -g 'daemon off;'" + command: + - sh + - -c + - | + set -e + envsubst '$$LANGGRAPH_UPSTREAM $$LANGGRAPH_REWRITE' \ + < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf + test -e /proc/net/if_inet6 || sed -i '/^[[:space:]]*listen[[:space:]]\+\[::\]:2026;/d' /etc/nginx/nginx.conf + exec nginx -g 'daemon off;' depends_on: - frontend - gateway