What you will set up
Immich backs up the photos and videos from your phone and shows them in a timeline, on a map and in albums you can share. It recognises faces, and it can search by what is in a picture: type a dog on a beach, and it finds it. The phone apps upload new pictures by themselves.
Here it runs as a Compose project under a user of its own called immich, behind Caddy from the Docker guide: the Immich server, its machine learning, PostgreSQL and Valkey. The photos stay on your server, in a folder you can back up.
The app-specific results below come from the tested Podman guide on a Melonslab server with Debian 13:
- Immich 3.2.2 was set up, and two photos were uploaded through its API, the way the phone apps upload.
- Thumbnails were made, and a search for
a dogput the dog first, anda catthe cat. - Everything came back by itself after a reboot, with the search still working.
In the Podman test, the pod used about 2.2 GB of memory, over half of it for machine learning. Immich asks for at least 6 GB on the server, and recommends 8 GB. With 4 GB, it runs with machine learning turned off. The photos take the space they take, so check your server's disk before you move a large library.
The Docker version below follows the tested rootless Docker base guide. The app-specific results above come from the tested Podman guide on a Melonslab server; they were not measured under Docker.
Before you start
You need:
- a server set up as in the Docker guide, with Caddy running, and at least 6 GB of memory;
- an A record and an AAAA record for
photos.example.compointing at your server.
The examples use photos.example.com for Immich and 203.0.113.10 for your server's IPv4 address, which ip -brief address show eth0 shows. Replace them throughout.
1. Create the user
As root:
useradd -m -s /bin/bash immich
loginctl enable-linger immich
uid=$(id -u immich)
Everything up to step 4 runs as immich.
2. Create the database password
The passwords are generated with the Compose file in the next step and kept in a 0600 file under the app directory.
3. Define the Compose project
Create a Compose file in the app's directory. It uses the same images, ports, volumes, environment and restart policy as the Podman guide:
mkdir -p /home/immich/immich
cat > /home/immich/immich/compose.yaml <<'YAML'
services:
db:
image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0
volumes:
- db:/var/lib/postgresql/data
environment:
POSTGRES_USER: postgres
POSTGRES_DB: immich
POSTGRES_INITDB_ARGS: --data-checksums
env_file: immich.env
restart: always
redis:
image: docker.io/valkey/valkey:9
restart: always
ml:
image: ghcr.io/immich-app/immich-machine-learning:v3
volumes:
- model-cache:/cache
restart: always
server:
image: ghcr.io/immich-app/immich-server:v3
ports:
- "127.0.0.1:8098:2283"
shm_size: 128m
volumes:
- /home/immich/immich/library:/data
environment:
DB_HOSTNAME: 127.0.0.1
DB_USERNAME: postgres
DB_DATABASE_NAME: immich
REDIS_HOSTNAME: 127.0.0.1
IMMICH_MACHINE_LEARNING_URL: http://127.0.0.1:3003
TZ: Europe/Stockholm
IMMICH_TRUSTED_PROXIES: 203.0.113.10
env_file: immich.env
restart: always
volumes:
db:
model-cache:
YAML
umask 077
pw=$(openssl rand -hex 24)
printf 'POSTGRES_PASSWORD=%s\nDB_PASSWORD=%s\n' "$pw" "$pw" > /home/immich/immich/immich.env
unset pw
chmod 600 /home/immich/immich/immich.env
chown -R immich:immich /home/immich/immich
uid=$(id -u immich)
runuser -u immich -- env HOME=/home/immich XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/immich/immich && docker compose up -d"
Use the weekly docker-update.service/docker-update.timer from the rootless Docker guide instead of Podman's auto-update timer. It runs docker compose pull and docker compose up -d in the app directory each Sunday. Set it up once for immich as shown there; it covers every Compose app in that user's home.
The first start downloads the images, which take about 3.6 GB of disk, and takes a few minutes.
4. Put Caddy in front
Go back to root with exit, switch to runuser -u caddy -- /bin/bash, and add this block at the end of ~/Caddyfile:
photos.example.com {
reverse_proxy 127.0.0.1:8098
}
Restart Caddy with docker compose restart caddy from /home/caddy/caddy as caddy. Caddy passes uploads of any size, so large videos go through too.
5. Set it up
Open https://photos.example.com, and choose Getting Started. Create the admin account, with Admin Email, Admin Password, Confirm Admin Password and Name, and log in. Immich then walks you through a few settings. Two of them are about outside services:
- Server Privacy: Map loads map tiles from
tiles.immich.cloud, and Version Check asksversion.immich.cloudfor new releases. Both are on. Turn them off if you want Immich not to contact anyone. - User Privacy: Google Cast loads resources from Google. It is off, and this guide leaves it off.
Every setting can be changed later, under Administration and Settings.
To give someone else an account, open Administration, Users, and choose Create user. Immich has no open sign-up page.
6. Upload from your phone
Install Immich's app for Android or iPhone. Enter https://photos.example.com as the server, log in, and turn on backup for the albums you want. New photos then go to your server by themselves. On a computer, drag photos into the web page.
The first time Immich processes photos, its machine-learning container downloads its models, about 800 MB: from Hugging Face, and the model that reads text in pictures from ModelScope. Only the models are downloaded. Your photos never leave your server.
7. Back up
Everything worth keeping is in ~/immich/library: the photos and videos as they were uploaded, and, in its backups folder, a copy of the database that Immich makes every night at 02:00, keeping the last 14. Copy the whole folder to another machine regularly, for example with rsync.
To make a copy of the database right now, as immich:
uid=$(id -u immich)
runuser -u immich -- env HOME=/home/immich XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash <<'SH'
cd /home/immich/immich
mkdir -p ~/backup
docker compose exec -T db pg_dumpall --clean --if-exists -U postgres | gzip > ~/backup/immich-db.sql.gz
SH
Troubleshooting
Search finds nothing, or faces are not recognised. Machine learning runs in the background, after thumbnails. Administration, Job Queues shows what is waiting. The first run also waits for the models to download.
The page does not load after an update. Read docker compose logs server. A new Immich release sometimes needs a new database image: its release notes say so, and name the new tag for compose.yaml.