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