Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Support] jj9987 - PostgreSQL

Featured Replies

  • Author
1 hour ago, Braulio Dias Ribeiro said:

 

How can I connect postgres to another docker?
What do I need to type in the PATH?

 

02.png

01.png

If both containers (the application and postgresql) are in the same custom network, you can connect using postgresql container's (host)name. If you are using host networking, you will need to use the host IP.

  • Replies 117
  • Views 50.7k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • If someone hits the same issue it turns out that if you follow the template and directly put your data on a cache like /mnt/ssd_cache/appdata/ instead of /mnt/user/appdata whenever mover gets invoked

  • I too use psql for nextcloud, and while I'm no db expert.. let alone psql, I just went through the process after fiddling with it for a while, only made complicated by docker really.   Just

  • I have Postgres10 and pgadmin4 working properly together. I want to schedule regular backups of my db. It looks like pgagent is the tool I need. I found these instructions for installing it in the pos

Posted Images

14 hours ago, jj9987 said:

If both containers (the application and postgresql) are in the same custom network, you can connect using postgresql container's (host)name. If you are using host networking, you will need to use the host IP.

 

They are on the same network.
But I don't know how to set username and password. Is that it?

 

postgresql://USER:PASSWORD@Postgres:5432/langflow

 

image.png.833fe77f4631fae126d37c8513bccf0e.png

 

  • Author
On 9/5/2024 at 9:59 AM, Braulio Dias Ribeiro said:

 

They are on the same network.
But I don't know how to set username and password. Is that it?

 

postgresql://USER:PASSWORD@Postgres:5432/langflow

 

image.png.833fe77f4631fae126d37c8513bccf0e.png

 

If you are using the official PostgreSQL image, then you can configure the initial superuser using POSTGRES_USER and POSTGRES_PASSWORD environment variables for username/password and POSTGRES_DB for database name. For simplicity purposes, you can use these.

 

But it is recommended to connect with the superuser to the database and create a custom user and database for the application. You can follow PostgreSQL documentation for that, but the basics should be:

 

CREATE USER 'user' WITH ENCRYPTED PASSWORD 'password';
CREATE DATABASE 'database' WITH OWNER 'user';


 

Edited by jj9987

38 minutes ago, jj9987 said:

If you are using the official PostgreSQL image, then you can configure the initial superuser using POSTGRES_USER and POSTGRES_PASSWORD environment variables for username/password and POSTGRES_DB for database name. For simplicity purposes, you can use these.

 

But it is recommended to connect with the superuser to the database and create a custom user and database for the application. You can follow PostgreSQL documentation for that, but the basics should be:

 

CREATE USER 'user' WITH ENCRYPTED PASSWORD 'password';
CREATE DATABASE 'database' WITH OWNER 'user';


 

I wanted to know how to fill in this path, if this was right. I found the answer, here's the solution.
LANGFLOW_DATABASE_URL = postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}

In my case
postgresql://langflow:PASSWORD@Postgres:5432/langflow

  • 1 year later...

Hi. May i ask the maintainer to remove Port Mapping as the mandatory field of the template for all Postgres templates. I want to keep the databased on the seperate custom network as the backend but by forcing Port Mapping, it is published on the host, defeating the purpose. Many thanks in advance.

17 hours ago, nhatlinh said:

Hi. May i ask the maintainer to remove Port Mapping as the mandatory field of the template for all Postgres templates. I want to keep the databased on the seperate custom network as the backend but by forcing Port Mapping, it is published on the host, defeating the purpose. Many thanks in advance.

Just delete the port entries when you don't want them. Standard for all containers to have a default port mapping entry.

image.png

  • 2 months later...
On 9/16/2025 at 3:40 PM, Kilrah said:

Just delete the port entries when you don't want them. Standard for all containers to have a default port mapping entry.

image.png

You can't do that to the mandatory field. I had to replicate the template and modify it, removing it manually from the template. I agree that it is standard for all containers to have default but just don't make mandatory thus it can be remove with that button that you screenshot

Edited by nhatlinh

  • 3 weeks later...
  • Author
On 12/15/2025 at 9:50 AM, nhatlinh said:

You can't do that to the mandatory field. I had to replicate the template and modify it, removing it manually from the template. I agree that it is standard for all containers to have default but just don't make mandatory thus it can be remove with that button that you screenshot

Took me awhile, but I've updated the templates to make the port not mandatory. Been awhile since I've actively worked with those, never spotted it. Thanks for reporting!

I've also added newer PostgreSQL versions' templates.

  • 2 months later...

I'm not super tech savvy and it's possible I'm mistaken, but I believe that the fact that I'm running Unraid without a cache drive has caused this container to lose all data upon rebooting my server. I got it working as desired until I restarted to update Unraid. I had not noticed that, unlike every other Docker template I've found, it defaults to /mnt/cache/appdata rather than /mnt/user/appdata. And all data under /mnt/cache was lost on restart. I assume it was running on memory? My databases are gone without a trace.

Don't let this happen to you!

2 minutes ago, Embler said:

running on memory?

Any path that isn't mounted storage is in RAM

13 minutes ago, trurl said:

Any path that isn't mounted storage is in RAM

Sorry, you're not speaking plainly enough for me. Are you agreeing and saying that /mnt/cache is not mounted storage and is in RAM? Or are you saying that I'm wrong and /mnt/cache is mounted storage and not in ram, because I assume /mnt/ stands for mount(ed)? I don't know how Unraid handles these top level folders.

Sorry if I'm wrong to post this here, I should have noticed the problem myself, I just thought it might help someone else avoid doing it themselves.

Edited by Embler
grammar

9 minutes ago, Embler said:

Are you agreeing and saying that /mnt/cache is not mounted storage and is in RAM?

If there isn't a pool named "cache" that would be mounted as /mnt/cache then that path doesn't have anything mounted to it and will be in RAM.

10 minutes ago, Embler said:

Sorry if I'm wrong to post this here

It's fine, it's bad template publising practice to use default mounts that may not exist, publisher should fix.

Edited by Kilrah

  • 1 month later...

hi i installing postgresql for the first time i did version 18 as its the newest version but it wont run the log keeps talking about upgradin or so but i just installed it so i not sure what to do i looked at the links but that didnt help me

Error: in 18+, these Docker images are configured to store database data in a
       format which is compatible with "pg_ctlcluster" (specifically, using
       major-version-specific directory names).  This better reflects how
       PostgreSQL itself works, and how upgrades are to be performed.

       See also https://github.com/docker-library/postgres/pull/1259

       Counter to that, there appears to be PostgreSQL data in:
         /var/lib/postgresql/data (unused mount/volume)

       This is usually the result of upgrading the Docker image without
       upgrading the underlying database using "pg_upgrade" (which requires both
       versions).

       The suggested container configuration for 18+ is to place a single mount
       at /var/lib/postgresql which will then place PostgreSQL data in a
       subdirectory, allowing usage of "pg_upgrade --link" without mount point
       boundary issues.

       See https://github.com/docker-library/postgres/issues/37 for a (long)
       discussion around this process, and suggestions for how to do so.

** Press ANY KEY to close this window ** 

how do you install this the first time?

9 hours ago, comet424 said:

i did version 18 as its the newest version

What app did you install it for?

You need to use the version the app wants instead of "the newest", PG versions are often not intercompatible so e.g. if an app is written for 16 it usually won't run with 18.

i installed cuz it was the latest. i installed adminier. and Linkwarden.. the video was a year old or so so it was 17 and i figured you need 18 now

but all i did was install 18 after install it wouldnt run in the first place.. so do i need to install 17?

i installed the 18 version first after it installed it should be running.. but as soon as i click start all i get is that error log.. so then in the mean time i downloaded adminier and linkwarden figured maybe they gotta run before postgresl will run... but i figured postgresql has to be up and running before the other 2 can run

Edited by comet424

i installed the 18 version first after it installed it should be running.. but as soon as i click start all i get is that error log.. so then in the mean time i downloaed adminier and linkwarden figured maybe they gotta run before postgresl will run... but i figured postgresql has to be up and running before the other 2 can run

i watched this video

PostgreSQL on Unraid? Yes, and It’s Easier Than You Think!

it shows you install it. and boom its running but that doesnt work for 18 i guess ill try 17

this is the video for linkwarden...

(22) Your Bookmark Chaos Ends NOW! Linkwarden + Unraid Setup - YouTube

now he doesnt say that postgres version o only saw the post gres version in a previous video.. doesnt the postgres server need to be running before you can use the other 2 services? if so cant do that yet till postgres runs currently installing 17

update: so installing 17 installed.. and started up the 18 would never start right after installing

what is 18 for?

Edited by comet424

  • 2 weeks later...
  • Author

The error message says quite clearly, that

       Counter to that, there appears to be PostgreSQL data in:
         /var/lib/postgresql/data (unused mount/volume)

       This is usually the result of upgrading the Docker image without
       upgrading the underlying database using "pg_upgrade" (which requires both
       versions).

PostgreSQL updates can not be done in-place. If you had existing PostgreSQL database in the directory, then you can't simply use a newer image, you need to actually upgrade the database with pg_upgrade.

EDIT: Apparently there is a breaking change with official PostgreSQL 18 Docker image as well.

Important Change: the PGDATA environment variable of the image was changed to be version specific in PostgreSQL 18 and above. For 18 it is /var/lib/postgresql/18/docker. Later versions will replace 18 with their respective major version (e.g., /var/lib/postgresql/19/docker for PostgreSQL 19.x). The defined VOLUME was changed in 18 and above to /var/lib/postgresql. Mounts and volumes should be targeted at the updated location. This will allow users upgrading between PostgreSQL major releases to use the faster --link when running pg_upgrade and mounting /var/lib/postgresql.

Important Note: (for PostgreSQL 17 and below) Mount the data volume at /var/lib/postgresql/data and not at /var/lib/postgresql because mounts at the latter path WILL NOT PERSIST database data when the container is re-created. The Dockerfile that builds the image declares a volume at /var/lib/postgresql/data and if no data volume is mounted at that path then the container runtime will automatically create an anonymous volume that is not reused across container re-creations. Data will be written to the anonymous volume rather than your intended data volume and won't persist when the container is deleted and re-created.

I've updated the PostgreSQL 18 template to use the correct volume.

Edited by jj9987

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...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.