Please help me understand Postgres DB location when using Docker Compose (Immich)


volcs0

Recommended Posts

I installed Immich (photo server) using the Docker Compose plug in according to these instructions.

Here are the list of dockers it brings up.

I decided to wipe the install and start over with some new settings. So, I used the "Compose Down" feature.

I tried changing the Postgres password, but when I brought it back up (Compose Up), it wouldn't connect to the database. Changing the password back worked - and all of my picture data / thumbnails were still there - even though I thought I was starting over.

 

I tried to nuke everything - manually deleting the dockers, even going so far as to delete the Docker Compose plugin.

But even starting "from scratch" and doing everything over didn't work. When I bring up the dockers (Compose Up) - there it is - the same thumbnails and data from the Postgres database. And yes, I've deleted the Library folder, so the actual pictures are gone. It's just the database that remained.

 

So, I went into the console and manually deleted the Immich database using the DATABASE DROP command. 

Now, I can't get anything to work again. The Docker Compose plug-in log says that since the database is still there, it doesn't have to re-create it. 

How on earth can I delete the database? I know I have to delete the share with Postgres, but I don't see how or where to do that.

 

Thanks for the help and advice.

 

 

 

 

Link to comment

Looks like the database is stored in a docker volume (something that is not really best practice to use in unraid). The command "docker volume ls" should list the volumes on your system. According to the compose file the one with the postgres database is called pgdata, not sure it if will be named the same when listed on the command line. An alternative for finding it is to bring up the compose stack and then run a "docker inspect immich_postgres" and look for the volume section. Once you know the name of the volume you can bring the compose stack down and then run "docker volume rm <volume_name>" which should remove the volume.

Link to comment
1 hour ago, Jaybau said:

Might need to delete the appdata folders.

Might need to "update stack" for the changes.

 

6 hours ago, primeval_god said:

Looks like the database is stored in a docker volume (something that is not really best practice to use in unraid). The command "docker volume ls" should list the volumes on your system. According to the compose file the one with the postgres database is called pgdata, not sure it if will be named the same when listed on the command line. An alternative for finding it is to bring up the compose stack and then run a "docker inspect immich_postgres" and look for the volume section. Once you know the name of the volume you can bring the compose stack down and then run "docker volume rm <volume_name>" which should remove the volume.

 

So, someone on Reddit figured this out. I had to go into the immich_postgres docker and delete the /var/lib/postgresql/data folder.

Then when I rebuilt the stack, it recreated the database.

Simply deleting the docker didn't matter - somehow the data persisted.

Maybe I don't understand the difference between a docker container and a docker volume (likely)

 

Thanks for your help with this. I am learning new stuff every day...

 

 

 

Link to comment

A docker volume is persistent storage managed by docker that is mounted into a container's file system. The lifecycle of a volume is independent (generally speaking) of the container to which it is attached. So even when you remove a container its volumes may stick around. In your case I believe that the immich_postgres container is using a named volume which gets re-attached to the container every time you create it.

 

In unRAID we typically dont use docker volumes and instead bind mount host directories (typically under the appdata share) into containers for persistent storage instead. It is typically easier to grasp and manage than docker volumes for those unfamiliar with them. It is also the way dockerman (unRAID's docker manager) does things.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.