Files
aza/AzA march 2026/deploy/docker_ensure.ps1

36 lines
1.1 KiB
PowerShell
Raw Permalink Normal View History

2026-03-25 22:03:39 +01:00
$ErrorActionPreference = 'Stop'
Write-Host '[AZA] Ensuring Docker Desktop engine is running...'
# Start Docker Desktop service if present
$svc = Get-Service -Name 'com.docker.service' -ErrorAction SilentlyContinue
if ($svc) {
if ($svc.Status -ne 'Running') {
Write-Host '[AZA] Starting com.docker.service...'
Start-Service 'com.docker.service' -ErrorAction SilentlyContinue | Out-Null
}
}
# Launch Docker Desktop UI (safe if already running)
$dd = Join-Path $Env:ProgramFiles 'Docker\Docker\Docker Desktop.exe'
if (Test-Path $dd) {
Start-Process $dd -ErrorAction SilentlyContinue | Out-Null
}
# Quick check (no loops to avoid PS quoting issues)
Start-Sleep -Seconds 3
$out = & docker version 2>&1
if ($LASTEXITCODE -ne 0) {
Write-Host $out
throw 'Docker daemon not reachable. Open Docker Desktop and ensure it is running (Linux containers).'
}
# Must have Server section
if (($out | Out-String) -notmatch 'Server:') {
Write-Host $out
throw 'Docker CLI reachable but Server section missing. Docker engine is not ready.'
}
Write-Host '[AZA] OK: Docker engine reachable.'