10 lines
536 B
Batchfile
10 lines
536 B
Batchfile
@echo off
|
|
rem Stops ONE API replica (TARGET_INSTANCE_ID = X-Instance-Id = short container id) and leaves it stopped.
|
|
if "%TARGET_INSTANCE_ID%"=="" exit /b 2
|
|
set TARGET_INSTANCE_ID | findstr /r /x "TARGET_INSTANCE_ID=[a-zA-Z0-9_.-][a-zA-Z0-9_.-]*" >nul || exit /b 2
|
|
set "CID="
|
|
for /f %%i in ('docker ps -q --filter "label=com.docker.compose.project=mtusi-lab4" --filter "label=com.docker.compose.service=api" --filter "id=%TARGET_INSTANCE_ID%"') do set "CID=%%i"
|
|
if "%CID%"=="" exit /b 1
|
|
docker stop -t 5 %CID% >nul
|
|
exit /b %errorlevel%
|