38 lines
1.3 KiB
PowerShell
38 lines
1.3 KiB
PowerShell
###############################################################################
|
|
# pod-stop.ps1 — Stop and remove the o11v4 pod and all its containers
|
|
#
|
|
# Usage: .\pod-stop.ps1
|
|
# .\pod-stop.ps1 -PodName my-pod
|
|
# .\pod-stop.ps1 -RemoveImage # also delete the built image
|
|
###############################################################################
|
|
|
|
param(
|
|
[string]$PodName = "o11v4-pod",
|
|
[string]$ImageName = "o11v4",
|
|
[switch]$RemoveImage
|
|
)
|
|
|
|
$ErrorActionPreference = "SilentlyContinue"
|
|
|
|
Write-Host ""
|
|
Write-Host "Stopping pod '$PodName'..." -ForegroundColor Yellow
|
|
|
|
# ── Stop and remove the pod (takes all containers with it) ──────────────────
|
|
podman pod stop $PodName 2>$null
|
|
podman pod rm -f $PodName 2>$null
|
|
|
|
if ($LASTEXITCODE -eq 0 -or $true) {
|
|
Write-Host "Pod stopped and removed." -ForegroundColor Green
|
|
}
|
|
|
|
# ── Optionally remove the image ─────────────────────────────────────────────
|
|
if ($RemoveImage) {
|
|
Write-Host "Removing image '$ImageName'..." -ForegroundColor Yellow
|
|
podman rmi $ImageName 2>$null
|
|
Write-Host "Image removed." -ForegroundColor Green
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "Done. To start again: .\pod-start.ps1" -ForegroundColor Cyan
|
|
Write-Host ""
|