fix: Resolve host.docker.internal hostname resolution issue
- Change cache host from 'host.docker.internal' to empty string - Allow act_runner to auto-detect the correct host IP address - Update all runner configs: docker, heavy, light, security - Improve troubleshooting scripts with host IP detection: - Linux/macOS: Use ip route, hostname -I, or ifconfig - Windows: Use Get-NetIPAddress PowerShell cmdlets - Update documentation to reflect auto-detection approach This resolves the 'getaddrinfo ENOTFOUND host.docker.internal' error by using a more compatible approach that works across different Docker setups and operating systems.
This commit is contained in:
@@ -62,6 +62,35 @@ test_network() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to detect the correct host IP
|
||||
detect_host_ip() {
|
||||
echo "🔍 Detecting host IP address..."
|
||||
|
||||
# Try different methods to get the host IP
|
||||
if command -v ip > /dev/null 2>&1; then
|
||||
# Linux with ip command
|
||||
HOST_IP=$(ip route get 1.1.1.1 | awk '{print $7; exit}' 2>/dev/null)
|
||||
elif command -v hostname > /dev/null 2>&1; then
|
||||
# Try hostname -I (Linux)
|
||||
HOST_IP=$(hostname -I | awk '{print $1}' 2>/dev/null)
|
||||
elif command -v ifconfig > /dev/null 2>&1; then
|
||||
# Try ifconfig (macOS/BSD)
|
||||
HOST_IP=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1' | head -1)
|
||||
else
|
||||
# Fallback to localhost
|
||||
HOST_IP="127.0.0.1"
|
||||
fi
|
||||
|
||||
if [ -z "$HOST_IP" ] || [ "$HOST_IP" = "127.0.0.1" ]; then
|
||||
echo "⚠️ Could not detect host IP, using localhost"
|
||||
HOST_IP="127.0.0.1"
|
||||
else
|
||||
echo "✅ Detected host IP: $HOST_IP"
|
||||
fi
|
||||
|
||||
echo "$HOST_IP"
|
||||
}
|
||||
|
||||
# Function to fix common cache issues
|
||||
fix_cache_issues() {
|
||||
echo "🔧 Applying cache fixes..."
|
||||
@@ -71,12 +100,15 @@ fix_cache_issues() {
|
||||
mkdir -p "$CACHE_DIR"
|
||||
chmod 755 "$CACHE_DIR"
|
||||
|
||||
# Detect host IP
|
||||
HOST_IP=$(detect_host_ip)
|
||||
|
||||
# Set proper environment variables
|
||||
export ACTIONS_CACHE_URL="http://host.docker.internal:44029/"
|
||||
export ACTIONS_RUNTIME_URL="http://host.docker.internal:44029/"
|
||||
export ACTIONS_CACHE_URL="http://${HOST_IP}:44029/"
|
||||
export ACTIONS_RUNTIME_URL="http://${HOST_IP}:44029/"
|
||||
|
||||
echo "✅ Cache directory created and configured"
|
||||
echo "✅ Environment variables set"
|
||||
echo "✅ Environment variables set with host IP: $HOST_IP"
|
||||
}
|
||||
|
||||
# Function to restart cache service
|
||||
|
||||
Reference in New Issue
Block a user