Skip to content

Instantly share code, notes, and snippets.

@BlakePetersen
Created March 11, 2026 08:10
Show Gist options
  • Select an option

  • Save BlakePetersen/91e3a249d7179f082c223382407e1512 to your computer and use it in GitHub Desktop.

Select an option

Save BlakePetersen/91e3a249d7179f082c223382407e1512 to your computer and use it in GitHub Desktop.
Immich ML Worker setup for Windows PC (CUDA/RTX 4080)
# ABOUTME: Sets up the Immich ML worker with CUDA on a Windows PC.
# ABOUTME: Creates compose file and starts the container with GPU access.
# Check Docker is available
if (-not (Get-Command docker -ErrorAction SilentlyContinue)) {
Write-Host "Docker not found. Install Docker Desktop from https://www.docker.com/products/docker-desktop/" -ForegroundColor Red
Write-Host "Enable WSL 2 backend during install, then re-run this script." -ForegroundColor Red
exit 1
}
# Verify GPU access
Write-Host "Checking NVIDIA GPU access in Docker..." -ForegroundColor Cyan
docker run --rm --gpus all nvidia/cuda:12.3.1-base-ubuntu22.04 nvidia-smi
if ($LASTEXITCODE -ne 0) {
Write-Host "GPU not accessible in Docker. Make sure:" -ForegroundColor Red
Write-Host " 1. NVIDIA drivers are installed and up to date" -ForegroundColor Red
Write-Host " 2. Docker Desktop is using the WSL 2 backend" -ForegroundColor Red
Write-Host " 3. Docker Desktop has 'Use the WSL 2 based engine' enabled in Settings" -ForegroundColor Red
exit 1
}
Write-Host "GPU access confirmed." -ForegroundColor Green
# Create directory
$dir = "C:\docker\immich-ml"
New-Item -ItemType Directory -Force -Path $dir | Out-Null
# Write compose file
@"
services:
immich-machine-learning:
container_name: immich_ml
image: ghcr.io/immich-app/immich-machine-learning:release-cuda
restart: unless-stopped
ports:
- "3003:3003"
volumes:
- model-cache:/cache
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
volumes:
model-cache:
"@ | Set-Content -Path "$dir\docker-compose.yml" -Encoding UTF8
Write-Host "Compose file written to $dir\docker-compose.yml" -ForegroundColor Green
# Start the container
Set-Location $dir
Write-Host "Pulling and starting Immich ML worker..." -ForegroundColor Cyan
docker compose up -d
if ($LASTEXITCODE -eq 0) {
Write-Host ""
Write-Host "Immich ML worker is running on port 3003." -ForegroundColor Green
Write-Host "NAS Immich server is configured to connect to http://192.168.7.244:3003" -ForegroundColor Green
Write-Host ""
Write-Host "Verify with: docker logs immich_ml" -ForegroundColor Cyan
} else {
Write-Host "Failed to start. Check 'docker logs immich_ml' for details." -ForegroundColor Red
}
@BlakePetersen
Copy link
Author

Run in PowerShell as Administrator:

irm https://gist.githubusercontent.com/BlakePetersen/91e3a249d7179f082c223382407e1512/raw/immich-ml-setup.ps1 | iex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment