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:
@@ -68,6 +68,35 @@ function Test-NetworkConnectivity {
|
||||
}
|
||||
}
|
||||
|
||||
# Function to detect the correct host IP
|
||||
function Get-HostIP {
|
||||
Write-Host "🔍 Detecting host IP address..." -ForegroundColor Cyan
|
||||
|
||||
try {
|
||||
# Try to get the IP address of the default gateway interface
|
||||
$networkAdapters = Get-NetAdapter | Where-Object { $_.Status -eq "Up" -and $_.Name -notlike "*Loopback*" }
|
||||
if ($networkAdapters) {
|
||||
$ipConfig = Get-NetIPAddress -AddressFamily IPv4 | Where-Object {
|
||||
$_.InterfaceAlias -in $networkAdapters.Name -and $_.IPAddress -ne "127.0.0.1"
|
||||
} | Select-Object -First 1
|
||||
|
||||
if ($ipConfig) {
|
||||
$hostIP = $ipConfig.IPAddress
|
||||
Write-Host "✅ Detected host IP: $hostIP" -ForegroundColor Green
|
||||
return $hostIP
|
||||
}
|
||||
}
|
||||
|
||||
# Fallback to localhost
|
||||
Write-Host "⚠️ Could not detect host IP, using localhost" -ForegroundColor Yellow
|
||||
return "127.0.0.1"
|
||||
} catch {
|
||||
Write-Host "⚠️ Error detecting host IP: $($_.Exception.Message)" -ForegroundColor Yellow
|
||||
Write-Host " Using localhost as fallback" -ForegroundColor Gray
|
||||
return "127.0.0.1"
|
||||
}
|
||||
}
|
||||
|
||||
# Function to fix common cache issues
|
||||
function Fix-CacheIssues {
|
||||
Write-Host "🔧 Applying cache fixes..." -ForegroundColor Cyan
|
||||
@@ -76,12 +105,15 @@ function Fix-CacheIssues {
|
||||
$cacheDir = "$env:USERPROFILE\.cache\actcache"
|
||||
New-Item -ItemType Directory -Path $cacheDir -Force | Out-Null
|
||||
|
||||
# Detect host IP
|
||||
$hostIP = Get-HostIP
|
||||
|
||||
# Set proper environment variables
|
||||
$env:ACTIONS_CACHE_URL = "http://host.docker.internal:44029/"
|
||||
$env:ACTIONS_RUNTIME_URL = "http://host.docker.internal:44029/"
|
||||
$env:ACTIONS_CACHE_URL = "http://${hostIP}:44029/"
|
||||
$env:ACTIONS_RUNTIME_URL = "http://${hostIP}:44029/"
|
||||
|
||||
Write-Host "✅ Cache directory created and configured" -ForegroundColor Green
|
||||
Write-Host "✅ Environment variables set" -ForegroundColor Green
|
||||
Write-Host "✅ Environment variables set with host IP: $hostIP" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Function to restart cache service
|
||||
|
||||
Reference in New Issue
Block a user