@echo off rem Stops exactly ONE API replica: the container whose hostname equals TARGET_INSTANCE_ID (X-Instance-Id). rem Leaves it stopped; DB, LB and volumes are untouched. Restore separately: docker compose up -d setlocal if "%TARGET_INSTANCE_ID%"=="" exit /b 2 cd /d "%~dp0.." || exit /b 1 set "CID=" for /f %%i in ('docker ps -q --filter "id=%TARGET_INSTANCE_ID%" --filter "label=com.docker.compose.service=api"') do if not defined CID set "CID=%%i" if not defined CID exit /b 1 docker stop --time 5 %CID% >nul 2>&1 exit /b %errorlevel%