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
steps:
- name: Find DIND daemon
- name: Debug network configuration
run: |
echo "=== Checking /etc/hosts ==="
cat /etc/hosts
echo "=== Network interfaces and routes ==="
ip route show 2>/dev/null || route -n
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
for host in docker-runner.docker.internal host.docker.internal 172.17.0.1 gateway.docker.internal; do
echo "Testing: $host"
if timeout 2 sh -c "cat < /dev/null > /dev/tcp/$host/2375" 2>/dev/null; then
echo "✅ SUCCESS: Can reach DIND at $host:2375"
echo "DOCKER_HOST=tcp://$host:2375" >> $GITHUB_ENV
export DOCKER_HOST=tcp://$host:2375
docker version && break
else
echo "❌ FAILED: Cannot reach $host:2375"
fi
done
if timeout 2 sh -c "cat < /dev/null > /dev/tcp/$GATEWAY_IP/2375" 2>/dev/null; then
echo "✅ Can reach DIND at $GATEWAY_IP:2375"
echo "DOCKER_HOST=tcp://$GATEWAY_IP:2375" >> $GITHUB_ENV
export DOCKER_HOST=tcp://$GATEWAY_IP:2375
else
echo "❌ Cannot reach gateway at $GATEWAY_IP:2375"
echo "The DIND container might not be accessible from job containers"
echo "You may need to configure the runner to use --network=host or expose DIND port on host"
exit 1
fi
- name: Verify Docker connection
run: |
docker version
- name: Checkout repository
run: |