The original post: /r/datahoarder by /u/antidumb on 2025-02-17 14:34:48.
Hey, all. I'm missing something here and I'm not sure what it is. I have a script that should be working to run 10 docker instances on Windows and populating the info necessary. Something's going wrong somewhere and I can't figure out what I'm missing. It's not populating the downloader name, project, download number, and number of rsync thread. I'm not even sure this is the correct sub, but I hope it is. Script is as follows:
@echo off
setlocal enabledelayedexpansion
REM Run Watchtower to automatically update containers
docker run --detach ^
--name watchtower ^
--restart=on-failure ^
--volume /var/run/docker.sock:/var/run/docker.sock ^
containrrr/watchtower --label-enable --cleanup --interval 3600
REM Run 10 instances of ArchiveTeam Warrior with custom settings
set NUM_INSTANCES=10
set CONTAINER_NAME="archiveteam_warrior"
set IMAGE="atdr.meo.ws/archiveteam/warrior-dockerfile"
set PROJECT_NAME=auto
set DOWNLOADER=antidumb
set RSYNC_THREADS=20
set DOWNLOADS=6
REM Ensure Docker is running
docker info >nul 2>&1
if %errorlevel% neq 0 (
echo Docker is not running. Please start Docker and try again.
exit /b 1
)
REM Pull the latest ArchiveTeam Warrior image
echo Pulling the latest ArchiveTeam Warrior Docker image...
docker pull !IMAGE! || (
echo Failed to pull Docker image. Exiting.
exit /b 1
)
echo Docker image pulled successfully.
REM Create and start 10 Docker containers with unique ports and names
for /L %%i in (1,1,!NUM_INSTANCES!) do (
REM Set variables specific to each instance
set /a PORT=8000+%%i
set CONTAINER=!CONTAINER_NAME!_%%i
REM Echo the container start command for debugging
echo Starting container: !CONTAINER! on port !PORT!
echo docker run -d --name !CONTAINER! -p !PORT!:8001 !IMAGE! --project "!PROJECT_NAME!" --downloader "!DOWNLOADER!" --concurrent "!DOWNLOADS!" --rsync-threads "!RSYNC_THREADS!"
REM Run the container
docker run -d ^
--name !CONTAINER! ^
--restart unless-stopped ^
-p !PORT!:8001 ^
!IMAGE! ^
--project "!PROJECT_NAME!" ^
--downloader "!DOWNLOADER!" ^
--concurrent "!DOWNLOADS!" ^
--rsync-threads "!RSYNC_THREADS!"
REM Check if the container started successfully
if !errorlevel! equ 0 (
echo !CONTAINER! started on port !PORT!.
) else (
echo Failed to start !CONTAINER!.
REM Check the logs to understand why the container didn't start
docker logs !CONTAINER!
)
)
echo All !NUM_INSTANCES! ArchiveTeam Warrior instances have been started.
I've tried the variables mentioned above both with and without quotation marks, neither works as expected.
I have a similar bash script for my Macs and Linux systems, but the Windows one is messing me up.
Thanks!