I'm new to scripting and got a batch file generated to automate my Docker Desktop upgrades for the Immich app. The script automatically starts Docker if it's not running and then pulls the latest images. However, I'm unsure if it's fully correct or if there are better ways to do this. I need to replace the path in the script with my own directory for Immich. Any suggestions or improvements? Also, I just realized I accidentally posted this in the wrong subreddit and might move it later. Here's the script I was given:
```
@echo off
REM Check if Docker Desktop is running
tasklist /FI "IMAGENAME eq Docker Desktop.exe" | find /I "Docker Desktop.exe" >nul
IF ERRORLEVEL 1 (
echo Starting Docker Desktop...
start "" "C:Program FilesDockerDockerDocker Desktop.exe"
echo Waiting for Docker to start...
REM Wait until Docker is actually ready
:waitloop
docker info >nul 2>&1
IF ERRORLEVEL 1 (
timeout /t 3 >nul
goto waitloop
)
)
REM Navigate to the project directory
cd /d D:DatenBilderimmich-app
REM Run the Docker Compose commands
docker compose pull && docker compose up -d
pause
```
1 Answer
Yikes, that's quite a script you’ve got there! Just a heads up, this doesn’t technically upgrade anything; it simply ensures Docker is running and pulls the latest images. You might want to focus on the last line instead of the full script. Also, try using pinned versions for your Docker images to avoid auto-updating to potentially unstable versions. Blindly upgrading can break your setup!
Got it! I usually read the update notes anyway before doing anything major. But can you clarify what you mean by pinned versions?