From 05699eea7d3130ddd11048f714a3783cd31be323 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 11 Jan 2026 21:38:55 +0000 Subject: [PATCH 1/2] Initial plan From 99f2716c6b37ff9f968c207f63190d61f2c622f0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 11 Jan 2026 21:41:47 +0000 Subject: [PATCH 2/2] Add host.docker.internal DNS resolution to container entrypoint Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> --- run_containerized.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/run_containerized.sh b/run_containerized.sh index 85414a69..413a70fc 100755 --- a/run_containerized.sh +++ b/run_containerized.sh @@ -236,6 +236,53 @@ set_docker_api_version() { log_info "Set DOCKER_API_VERSION=$DOCKER_API_VERSION for $arch" } +# Detect host IP and configure host.docker.internal DNS mapping +configure_host_dns() { + log_info "Detecting host IP for container networking..." + + local HOST_IP="" + + # Method 1: Try to get the primary network interface IP (not loopback) + HOST_IP=$(ip -4 addr show 2>/dev/null | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | grep -v '^127\.' | head -1) + if [ -n "$HOST_IP" ]; then + log_info "Method 1 (primary interface): $HOST_IP" + fi + + # Method 2: Try default gateway IP + if [ -z "$HOST_IP" ]; then + HOST_IP=$(ip route 2>/dev/null | grep default | awk '{print $3}' | head -1) + if [ -n "$HOST_IP" ]; then + log_info "Method 2 (default gateway): $HOST_IP" + fi + fi + + # Method 3: Try docker0 bridge IP + if [ -z "$HOST_IP" ]; then + HOST_IP=$(ip addr show docker0 2>/dev/null | grep 'inet ' | awk '{print $2}' | cut -d/ -f1) + if [ -n "$HOST_IP" ]; then + log_info "Method 3 (docker0 bridge): $HOST_IP" + fi + fi + + # Method 4: Last resort - common Docker bridge IP + if [ -z "$HOST_IP" ]; then + HOST_IP="172.17.0.1" + log_info "Method 4 (fallback): $HOST_IP" + fi + + log_info "Using host IP: $HOST_IP" + + # Add host.docker.internal mapping to /etc/hosts + # Check if the entry already exists to avoid duplicates + if ! grep -q "host.docker.internal" /etc/hosts 2>/dev/null; then + log_info "Adding host.docker.internal mapping to /etc/hosts" + echo "$HOST_IP host.docker.internal" >> /etc/hosts + log_info "DNS mapping configured: $HOST_IP -> host.docker.internal" + else + log_info "host.docker.internal already exists in /etc/hosts" + fi +} + # Build command line arguments build_command_args() { local host="${MCP_GATEWAY_HOST:-0.0.0.0}" @@ -285,6 +332,9 @@ main() { validate_log_directory_mount "$CONTAINER_ID" fi + # Configure DNS for host.docker.internal + configure_host_dns + # Build command FLAGS=$(build_command_args) CMD="./awmg"