#Docker Prune - now Immich won't start

1 messages · Page 1 of 1 (latest)

rustic light
#

I noticed my docker images were taking up a significant amount of disk space (70+ GBs). So I did a docker prune while Immich was running. Now I can't get Immich to run. I threw the log into Claude and it said the geocoding was corrupted (naturalearth_countries table specifically). So I truncated and then dumped that table and the geodata_places table, as instructed by Claude) and re-ran Immich migration to see if it would recreate the tables. Nothing seems to work.

Is there a way to get Immich to recreate the dependencies and tables it needs to run or am I screwed? I don't want to have to start from scratch because I input and updated so much metadata within Immich (favorites, machine learning, etc).

eternal epochBOT
#

:wave: Hey @rustic light,

Thanks for reaching out to us. Please carefully read this message and follow the recommended actions. This will help us be more effective in our support effort and leave more time for building Immich immich.

References

#

Checklist

I have...

  1. :ballot_box_with_check: verified I'm on the latest release(note that mobile app releases may take some time).
  2. :ballot_box_with_check: read applicable release notes.
  3. :ballot_box_with_check: reviewed the FAQs for known issues.
  4. :ballot_box_with_check: reviewed Github for known issues.
  5. :ballot_box_with_check: tried accessing Immich via local ip (without a custom reverse proxy).
  6. :ballot_box_with_check: uploaded the relevant information (see below).
  7. :ballot_box_with_check: tried an incognito window, disabled extensions, cleared mobile app cache, logged out and back in, different browsers, etc. as applicable

(an item can be marked as "complete" by reacting with the appropriate number)

Information

In order to be able to effectively help you, we need you to provide clear information to show what the problem is. The exact details needed vary per case, but here is a list of things to consider:

  • Your docker-compose.yml and .env files.
  • Logs from all the containers and their status (see above).
  • All the troubleshooting steps you've tried so far.
  • Any recent changes you've made to Immich or your system.
  • Details about your system (both software/OS and hardware).
  • Details about your storage (filesystems, type of disks, output of commands like fdisk -l and df -h).
  • The version of the Immich server, mobile app, and other relevant pieces.
  • Any other information that you think might be relevant.

Please paste files and logs with proper code formatting, and especially avoid blurry screenshots.
Without the right information we can't work out what the problem is. Help us help you ;)

If this ticket can be closed you can use the /close command, and re-open it later if needed.

acoustic wraith
#

Please post info as requested above. In particular: logs.

We saw docker image corruptions in the past. You may want to pull Immich image afresh

docker compose down immich-server
docker image prune -a
docker compose pull
docker compose up -d
rustic light
#

Running in Docker Desktop on my Mac Mini 2014 strictly used as a server. Latest version of Immich.

I noticed my docker images were taking up a significant amount of disk space (70+ GBs). So I ran "docker system prune" while Immich was running. Now I can't get Immich to run.

When I ran all of this by Claude it said the geocoding was corrupted (naturalearth_countries table specifically). So I truncated and then dumped that table and the geodata_places table, as instructed by Claude) and re-ran Immich migration to see if it would recreate the tables. That didn't work. Then it had me re-add those tables manually and still nothing worked. I tried to restore my entire DockerServer directory from my backup service from before I did the pruning to see if that would put everything back to normal - that didn't work either.

eternal epochBOT
acoustic wraith
#

Most likely we can recreate the missing entities in the database schema. Need to understand the current state first.
Btw, do you have (automatic) database backups?

acoustic wraith
#

Could you run the following script (copy-paste commands into terminal)

version=release
network=immich_default
db_password=pi39fLQ7dW4josGT
docker run --rm --network $network -e DB_URL="postgres://postgres:${db_password}@database:5432/immich" --entrypoint bash ghcr.io/immich-app/immich-server:$version -c 'node /usr/src/app/server/dist/bin/migrations.js debug && cat migrations.sql'

It should print the database schema drift (differences from expected state upon manual changes)

rustic light
#
Wrote migrations.sql
-- UP
CREATE TABLE "geodata_places" (
  "id" integer NOT NULL,
  "name" character varying(200) NOT NULL,
  "longitude" double precision NOT NULL,
  "latitude" double precision NOT NULL,
  "countryCode" character(2) NOT NULL,
  "admin1Code" character varying(20),
  "admin2Code" character varying(80),
  "modificationDate" date NOT NULL,
  "admin1Name" character varying,
  "admin2Name" character varying,
  "alternateNames" character varying,
  CONSTRAINT "geodata_places_pkey" PRIMARY KEY ("id")
); -- missing in target
CREATE INDEX "IDX_geodata_gist_earthcoord" ON "geodata_places" (ll_to_earth_public(latitude, longitude)); -- missing in target
CREATE INDEX "idx_geodata_places_name" ON "geodata_places" USING gin (f_unaccent("name") gin_trgm_ops); -- missing in target
CREATE INDEX "idx_geodata_places_admin2_name" ON "geodata_places" USING gin (f_unaccent("admin2Name") gin_trgm_ops); -- missing in target
CREATE INDEX "idx_geodata_places_admin1_name" ON "geodata_places" USING gin (f_unaccent("admin1Name") gin_trgm_ops); -- missing in target
CREATE INDEX "idx_geodata_places_alternate_names" ON "geodata_places" USING gin (f_unaccent("alternateNames") gin_trgm_ops); -- missing in target
CREATE TABLE "naturalearth_countries" (
  "id" integer NOT NULL GENERATED ALWAYS AS IDENTITY,
  "admin" character varying(50) NOT NULL,
  "admin_a3" character varying(3) NOT NULL,
  "type" character varying(50) NOT NULL,
  "coordinates" polygon NOT NULL,
  CONSTRAINT "naturalearth_countries_pkey" PRIMARY KEY ("id")
); -- missing in target

#

I do have automatic database backups. Can I use those to fix all of this and how?

rustic light
#

I just ran this command to restore the last db backup and it seems to be working again.
gunzip < /Volumes/.../backups/immich-db-backup-20251218T020005-v2.3.1-pg14.19.sql.gz | docker exec -i immich_postgres psql -U postgres -d immich

rustic light
#

Now my next question is, how do I prevent the images from getting so big and taking up all of my HDD space? Right now in Docker Desktop my Disk usage limit is at 1 TB (which I see now is way too big). I'm only using about 7 GB right now. The problem is if I move the Resource slider down it gives me this warning "Resizing to a smaller size will delete the disk image; all Docker images, containers and volumes will be lost." What should I do?