Skip to content

Commit 4713f9e

Browse files
committed
CI Work-around for Docker on Windows error
1 parent 65393af commit 4713f9e

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

.github/workflows/wheels.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,11 @@ jobs:
182182
output-dir: dist
183183
config-file: cibuildwheel.toml
184184

185+
# Necessary to avoid GHA issues with Docker on Windows
186+
# https://github.com/actions/runner-images/issues/13729
187+
- name: Wait for Docker to be ready
188+
run: pwsh tools/wait-for-docker-windows.ps1
189+
185190
# Running in a minimal Docker image makes sure that we bundled correctly
186191
# the shared libraries for MSVC C++ runtime and OpenMP in the Windows
187192
# wheel

tools/wait-for-docker-windows.ps1

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env pwsh
2+
3+
# Script to wait for Docker to be ready taken from https://github.com/spiffe/spire project
4+
5+
Write-Host "Waiting for Docker to be ready..."
6+
7+
for ($i = 1; $i -le 60; $i++) {
8+
# Check if Docker is ready
9+
$output = docker info 2>&1
10+
if ($LASTEXITCODE -eq 0) {
11+
Write-Host "Docker is ready!"
12+
exit 0
13+
}
14+
15+
# On first attempt, list and start Docker services
16+
if ($i -eq 1) {
17+
Write-Host "Docker not ready. Checking for Docker services..."
18+
$dockerServices = Get-Service | Where-Object { $_.Name -like '*docker*' -or $_.DisplayName -like '*docker*' }
19+
20+
if ($dockerServices) {
21+
Write-Host "Available Docker services:"
22+
$dockerServices | Format-Table Name, Status, DisplayName -AutoSize
23+
24+
# Start any stopped Docker services
25+
$dockerServices | Where-Object { $_.Status -ne 'Running' } | ForEach-Object {
26+
Write-Host "Starting service: $($_.Name)"
27+
Start-Service $_.Name -ErrorAction SilentlyContinue
28+
}
29+
} else {
30+
Write-Error "No Docker services found. Please ensure Docker is installed and configured correctly."
31+
exit 1
32+
}
33+
}
34+
35+
# Show progress (detailed every 10 attempts)
36+
if ($i % 10 -eq 0) {
37+
Write-Host "Attempt $i/60 - Still waiting... Error: $output"
38+
} else {
39+
Write-Host "Attempt $i/60"
40+
}
41+
Start-Sleep -Seconds 2
42+
}
43+
44+
Write-Error "Docker failed to start after 60 attempts"
45+
exit 1

0 commit comments

Comments
 (0)