Try gateway IP from routing table for DIND connection
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 27s

- Get default gateway IP from routing table
- Test connection to DIND on gateway
- Provide instructions if connection fails
- Network isolation might need runner configuration fix

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Kevin Sivic 2025-12-01 00:01:50 -05:00
parent f7ed4c163d
commit 3f3540e97b

View file

@ -12,26 +12,30 @@ jobs:
image: docker:latest image: docker:latest
steps: steps:
- name: Find DIND daemon - name: Debug network configuration
run: | run: |
echo "=== Checking /etc/hosts ===" echo "=== Network interfaces and routes ==="
cat /etc/hosts ip route show 2>/dev/null || route -n
echo "" echo ""
echo "=== Testing DIND connection options ===" echo "=== Testing gateway IP directly ==="
GATEWAY_IP=$(ip route show | grep default | awk '{print $3}')
echo "Gateway IP: $GATEWAY_IP"
# Try different hostnames/IPs if timeout 2 sh -c "cat < /dev/null > /dev/tcp/$GATEWAY_IP/2375" 2>/dev/null; then
for host in docker-runner.docker.internal host.docker.internal 172.17.0.1 gateway.docker.internal; do echo "✅ Can reach DIND at $GATEWAY_IP:2375"
echo "Testing: $host" echo "DOCKER_HOST=tcp://$GATEWAY_IP:2375" >> $GITHUB_ENV
if timeout 2 sh -c "cat < /dev/null > /dev/tcp/$host/2375" 2>/dev/null; then export DOCKER_HOST=tcp://$GATEWAY_IP:2375
echo "✅ SUCCESS: Can reach DIND at $host:2375" else
echo "DOCKER_HOST=tcp://$host:2375" >> $GITHUB_ENV echo "❌ Cannot reach gateway at $GATEWAY_IP:2375"
export DOCKER_HOST=tcp://$host:2375 echo "The DIND container might not be accessible from job containers"
docker version && break echo "You may need to configure the runner to use --network=host or expose DIND port on host"
else exit 1
echo "❌ FAILED: Cannot reach $host:2375" fi
fi
done - name: Verify Docker connection
run: |
docker version
- name: Checkout repository - name: Checkout repository
run: | run: |