# 重启容器(backend / frontend / all),无需重启 Docker Desktop param( [ValidateSet("backend", "frontend", "all")] [string]$Service = "all" ) $ErrorActionPreference = "Stop" $Root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path) Set-Location $Root if ($Service -eq "all") { Write-Host "Restarting backend and frontend..." -ForegroundColor Cyan docker compose restart backend frontend } else { Write-Host "Restarting $Service..." -ForegroundColor Cyan docker compose restart $Service } if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } Write-Host "Done. Docker Desktop was NOT restarted." -ForegroundColor Green