Skip to content

Commit 124e7fe

Browse files
committed
update
1 parent 30ebd27 commit 124e7fe

1 file changed

Lines changed: 50 additions & 1 deletion

File tree

.github/workflows/windows-ltsc2025-test.yml

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,57 @@ jobs:
2121
- name: Checkout
2222
uses: actions/checkout@v4
2323

24-
- name: Show Docker info
24+
- name: Ensure Docker daemon is running
25+
shell: pwsh
26+
working-directory: .
2527
run: |
28+
# Workaround for actions/runner-images#13729:
29+
# On Windows runners the docker service is sometimes left in the Stopped
30+
# state at job start because the Hyper-V virtual switch fails to
31+
# initialise during the runner's resume from a saved image. Starting
32+
# the service (with retries) recovers the daemon.
33+
$ErrorActionPreference = 'Continue'
34+
35+
$ready = $false
36+
for ($attempt = 1; $attempt -le 5; $attempt++) {
37+
$svc = Get-Service -Name docker -ErrorAction SilentlyContinue
38+
if (-not $svc) {
39+
throw "docker service is not installed on this runner."
40+
}
41+
Write-Host "Attempt $attempt: docker service status is $($svc.Status)"
42+
if ($svc.Status -ne 'Running') {
43+
Start-Service -Name docker -ErrorAction SilentlyContinue
44+
Start-Sleep -Seconds 3
45+
}
46+
47+
$deadline = (Get-Date).AddSeconds(60)
48+
while ((Get-Date) -lt $deadline) {
49+
docker version --format '{{.Server.Version}}' *> $null
50+
if ($LASTEXITCODE -eq 0) { $ready = $true; break }
51+
Start-Sleep -Seconds 2
52+
}
53+
54+
if ($ready) {
55+
Write-Host "Docker daemon is responsive."
56+
break
57+
}
58+
59+
Write-Host "Daemon did not respond on attempt $attempt; restarting service."
60+
Stop-Service -Name docker -Force -ErrorAction SilentlyContinue
61+
Start-Sleep -Seconds 2
62+
}
63+
64+
if (-not $ready) {
65+
Write-Host "::group::Docker service state"
66+
Get-Service -Name docker | Format-List *
67+
Write-Host "::endgroup::"
68+
Write-Host "::group::Recent Application event log (docker)"
69+
Get-EventLog -LogName Application -Source docker -Newest 20 -ErrorAction SilentlyContinue |
70+
Format-List TimeGenerated, EntryType, Message
71+
Write-Host "::endgroup::"
72+
throw "Docker daemon did not become ready after 5 attempts."
73+
}
74+
2675
docker version
2776
docker info
2877

0 commit comments

Comments
 (0)