-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-docker-apps.ps1
More file actions
52 lines (43 loc) · 1.58 KB
/
Copy pathstart-docker-apps.ps1
File metadata and controls
52 lines (43 loc) · 1.58 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
46
47
48
49
50
51
52
# Start Docker Desktop and then bring up the app stack.
# Use this from Windows startup or Task Scheduler.
$dockerDesktopExe = "${env:ProgramFiles}\Docker\Docker\Docker Desktop.exe"
if (-not (Test-Path $dockerDesktopExe)) {
Write-Error "Docker Desktop executable not found at $dockerDesktopExe. Please install Docker Desktop or update the script path."
exit 1
}
Write-Output "Starting Docker Desktop..."
Start-Process -FilePath $dockerDesktopExe -WindowStyle Minimized
$maxWaitSeconds = 300
$waitIntervalSeconds = 5
$elapsed = 0
Write-Output "Waiting for Docker daemon to become available..."
while ($true) {
try {
docker version --format '{{.Server.Version}}' > $null 2>&1
if ($LASTEXITCODE -eq 0) {
break
}
} catch {
# ignore errors while waiting
}
if ($elapsed -ge $maxWaitSeconds) {
Write-Error "Docker did not become available within $maxWaitSeconds seconds. Check Docker Desktop manually."
exit 1
}
Start-Sleep -Seconds $waitIntervalSeconds
$elapsed += $waitIntervalSeconds
}
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
Set-Location $scriptDir
Write-Output "Starting Docker Compose services..."
$composeFile = Join-Path $scriptDir 'docker-compose.local-8080.yml'
if (-not (Test-Path $composeFile)) {
Write-Error "Compose file not found: $composeFile"
exit 1
}
docker compose -f $composeFile up -d
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to start Docker Compose stack."
exit $LASTEXITCODE
}
Write-Output "Docker Desktop started and app services are now running."