update
This commit is contained in:
35
AzA march 2026/deploy/docker_ensure.ps1
Normal file
35
AzA march 2026/deploy/docker_ensure.ps1
Normal file
@@ -0,0 +1,35 @@
|
||||
$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.'
|
||||
|
||||
Reference in New Issue
Block a user