@echo off rem Windows twin of scripts/stop-one.sh: the test cannot execute .sh on Windows. setlocal cd /d "%~dp0.." if "%TARGET_INSTANCE_ID%"=="" exit /b 2 rem Hex only: the value is substituted into a docker command. echo %TARGET_INSTANCE_ID%|findstr /r /x "[0-9a-f][0-9a-f]*" >nul || exit /b 2 set "CONTAINER=" 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 "CONTAINER=%%i" if not defined CONTAINER exit /b 3 rem SIGTERM -> drain (3 s) -> exit; -t 8 keeps the hook inside the 10 s budget. docker stop -t 8 %CONTAINER% >nul || exit /b 1 echo stopped %CONTAINER%