Google Photos is convenient until you hit the 15 GB cap or realise your entire photo library is being used to train someone else’s models. Immich solves both problems: it gives you Google Photos-grade functionality — automatic backup, facial recognition, smart search, album sharing — entirely self-hosted on your own hardware.
This guide walks through a production-grade Immich deployment with Docker Compose: PostgreSQL for metadata, Redis for job queues, hardware-accelerated transcoding, ML model GPU acceleration, Traefik reverse proxy with automatic SSL, and a restic-based backup strategy for both photos and the database.
All commands target Debian 12 / Ubuntu 24.04 with Docker Engine 27+ and Docker Compose v2.
1. Infrastructure Layout
Immich has four runtime components that need to coordinate:
| Service | Role |
|---|---|
| immich-server | Main API server and web frontend |
| immich-microservices | Background tasks — transcoding, ML |
| postgres | Metadata database — albums, users, tags |
| redis | Job queue and cache |
| immich-machine-learning | Facial recognition, smart search |
Two optional but highly recommended additions are hardware transcoding (for HEVC/AV1 video thumbnails) and GPU ML acceleration (for fast face detection and CLIP-based search).
For storage, plan for: a fast SSD volume for Postgres data and Redis, and a large HDD or NAS share for library storage (photos, videos, thumbnails).
2. Directory Layout and Environment
Create the project tree:
|
|
Create .env with your initial configuration:
|
|
Store the DB password somewhere safe — you will need it for backups.
3. Docker Compose Configuration
|
|
Create the external Docker network if it does not already exist:
|
|
4. Traefik Reverse Proxy Integration
If you already run Traefik as your edge router, add the Traefik network to the Immich Compose file and let Traefik handle SSL.
Add this to the bottom of the services section in
docker-compose.yml:
|
|
Then connect Immich to your Traefik network:
|
|
The labels on the immich-server service (shown above) assume
Traefik’s letsencrypt certificate resolver is configured. If you
use Caddy or Nginx Proxy Manager instead, configure a reverse proxy
pass to http://immich-server:2283.
5. First Boot and Initial Setup
Pull images and start the stack:
|
|
Wait 30-60 seconds for Postgres to initialise, then check logs:
|
|
You should see Immich Server is running on port 3001 once it is
ready.
Open https://photos.yourdomain.com (or http://localhost:2283
locally) and create the initial admin account. This account is the
system administrator — store the credentials in your password
manager immediately.
5.1 Postgres Tuning for Immich
Immich generates a lot of writes during upload and ML processing. Tune Postgres inside the container:
|
|
Adjust shared_buffers to 25% of available RAM, and
effective_cache_size to 75% of available RAM.
6. Hardware Transcoding
Immich transcodes video thumbnails on the fly. Without hardware
acceleration, a 4K HEVC to WebP thumbnail conversion drains CPU.
Enable GPU passthrough in the immich-microservices service.
6.1 Intel QuickSync (QSV)
Add to the immich-microservices service:
|
|
Then in the Immich admin panel: Administration → Video Transcoding Settings → Hardware Acceleration → Intel QSV
6.2 NVIDIA GPU
Add to immich-microservices:
|
|
The video capability enables NVENC/NVDEC for hardware video
encoding and decoding.
In the admin panel: Hardware Acceleration → NVIDIA NVENC/NVDEC
6.3 Verify Transcoding
Upload a short HEVC video through the Immich web UI, then check that the microservice used the GPU:
|
|
7. Machine Learning Acceleration
The immich-machine-learning container handles facial recognition,
object detection (CLIP), and smart search embeddings. These are
computationally expensive — expect 1-3 seconds per image on CPU, or
50-100 ms on GPU.
Enable GPU for the ML container by uncommenting the deploy block
in the immich-machine-learning service section of the compose file,
then restart:
|
|
After enabling, go to Administration → Machine Learning Settings and set:
- Facial Recognition → Enabled
- CLIP Search → Enabled
- Scene Detection → Enabled
Trigger a full re-extraction on existing photos:
Administration → Jobs → All → Click the gear icon → Run All
Monitor progress from the command line:
|
|
8. Mobile App Configuration
Immich has native apps for Android and iOS. Configure them to connect to your Traefik domain:
- Install the Immich app from the app store
- Connection → Server Endpoint →
https://photos.yourdomain.com - Log in with your admin credentials
- Enable Background Backup (Android) or Backup over Cellular (both platforms)
The app syncs new photos within minutes of being taken. You can check sync status from the app’s Backup tab.
9. Backup Strategy
Immich stores two types of data: the PostgreSQL database (metadata) and uploaded files (raw photos and videos on disk). A proper backup strategy covers both.
9.1 Database Backup with pg_dump
Create a backup script:
|
|
Make it executable and schedule it:
|
|
9.2 Systemd Timer for Daily Backups
|
|
|
|
|
|
9.3 Restic Backup for Library Files
Use restic to back up the library directory to an S3-compatible storage endpoint (MinIO, Backblaze B2, or Wasabi):
|
|
Schedule with a second systemd timer, or combine both jobs into a single service file for simplicity.
10. Performance Tuning and Resource Limits
Immich can use significant resources during initial ML processing and first-time transcoding. Set container-level resource limits to prevent it from starving other services:
|
|
For the initial library import (first upload of thousands of photos), raise the microservices limit temporarily, then dial it back.
10.1 Docker System Pruning
Immich generates many intermediate objects during transcoding and thumbnail generation. Schedule a weekly prune:
|
|
11. Updating Immich
Immich releases frequently — typically monthly. Update with zero downtime using rolling restarts:
|
|
Check the Immich release notes before updating — major releases sometimes require manual database migration steps or version-specific upgrade paths.
12. Final Checks
After deployment, verify the full stack is running:
|
|
Open the web UI, upload a test photo, trigger a smart search, and confirm facial recognition detects a known face. If everything works, enable the mobile app backups and point your family to the Immich URL.
Immich replaces Google Photos without the privacy trade-off. Your photos stay on your drives, your face data stays on your server, and the features — timeline view, album sharing, partner sharing, smart search — match or exceed what the cloud offers. Set up backups early and the rest takes care of itself.