Skip to content

Commit 6d0cb38

Browse files
jinja2Copilot
andauthored
[chore] start docker service on windows (#7273)
* [chore] start docker service on windows * Update .github/actions/win-wait-for-docker/action.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 93a85ca commit 6d0cb38

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

.github/actions/win-wait-for-docker/action.yml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,51 @@
11
name: 'Wait for Docker service (Windows)'
2-
description: 'Ensure the Docker daemon is running on Windows runners. Attempts to start the service if needed.'
2+
description: >
3+
Ensure the Docker daemon is running on Windows runners. Attempts to start the service if needed.
4+
Workaround for https://github.com/actions/runner-images/issues/13729
35
46
inputs:
57
timeout:
68
description: 'Maximum seconds to wait for the Docker service'
79
required: false
810
default: '120'
11+
start_after:
12+
description: 'Seconds to wait before forcefully starting the Docker service'
13+
required: false
14+
default: '30'
915

1016
runs:
1117
using: "composite"
1218
steps:
1319
- name: Wait for Docker service
1420
run: |
1521
$timeout = [int]"${{ inputs.timeout }}"
22+
$startAfter = [int]"${{ inputs.start_after }}"
1623
$elapsed = 0
17-
$svc = Get-Service docker -ErrorAction SilentlyContinue
18-
if ($svc -and $svc.Status -ne 'Running') {
19-
Write-Host "Docker service status: $($svc.Status). Attempting to start..."
20-
Start-Service docker -ErrorAction SilentlyContinue
21-
} elseif (-not $svc) {
22-
Write-Host "Docker service not found. Installed services:"
23-
Get-Service *docker* | Format-Table -AutoSize
24-
}
24+
$startAttempted = $false
25+
2526
while ($elapsed -lt $timeout) {
2627
$svc = Get-Service docker -ErrorAction SilentlyContinue
2728
if ($svc -and $svc.Status -eq 'Running') {
2829
Write-Host "Docker service is running."
2930
docker version
3031
return
3132
}
33+
34+
if (-not $svc) {
35+
Write-Host "Docker service not found. Installed services:"
36+
Get-Service *docker* | Format-Table -AutoSize
37+
}
38+
39+
if ($elapsed -ge $startAfter -and -not $startAttempted) {
40+
if ($svc) {
41+
Write-Host "Docker not available after ${startAfter}s — starting the service (see https://github.com/actions/runner-images/issues/13729)"
42+
Start-Service docker -ErrorAction SilentlyContinue
43+
$startAttempted = $true
44+
} else {
45+
Write-Host "Docker service still not found after ${startAfter}s — will keep waiting for it to be registered."
46+
}
47+
}
48+
3249
Write-Host "Waiting for Docker service... ($elapsed s) status: $(if ($svc) { $svc.Status } else { 'not found' })"
3350
Start-Sleep 5
3451
$elapsed += 5

0 commit comments

Comments
 (0)