$ErrorActionPreference = 'Stop' Push-Location (Split-Path $PSScriptRoot -Parent) try { function Snapshot { foreach ($service in @('api', 'db')) { $containerId = docker compose ps -q $service if ($LASTEXITCODE -ne 0 -or -not $containerId) { throw 'Container not found' } docker inspect --format '{{.Name}} started={{.State.StartedAt}} status={{.State.Status}} volumes={{range .Mounts}}{{.Name}} {{end}}' $containerId if ($LASTEXITCODE -ne 0) { throw 'Inspect failed' } } } Snapshot | Set-Content evidence/restart-scope.txt docker compose stop api db if ($LASTEXITCODE -ne 0) { throw 'Stop failed' } docker compose up -d --wait --wait-timeout 30 db if ($LASTEXITCODE -ne 0) { throw 'Database start failed' } docker compose up -d --wait --wait-timeout 30 api if ($LASTEXITCODE -ne 0) { throw 'API start failed' } Snapshot | Add-Content evidence/restart-scope.txt } finally { Pop-Location }