You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to this: https://www.postgresql.org/message-id/12168.1312921709%40sss.pgh.pa.us
it is not possible to mount "data" dir directly as for example longhorn volume in kubernetes so I should mount the parent folder, but according to https://github.com/docker-library/postgres/blob/master/14/alpine/Dockerfile
line 155 VOLUME /var/lib/postgresql/data
it does not work to mount it, because then it only contains an empty "data" folder (next to the lost+found one) and the actuall database is then mounted separately into an anonymous volume and therefore lost on container restart.
So what is the solution?
The text was updated successfully, but these errors were encountered:
PGDATA
This optional variable can be used to define another location - like a subdirectory - for the database files. The default is /var/lib/postgresql/data. If the data volume you're using is a filesystem mountpoint (like with GCE persistent disks) or remote folder that cannot be chowned to the postgres user (like some NFS mounts), Postgres initdb recommends a subdirectory be created to contain the data.
For example:
$ docker run -d
--name some-postgres
-e POSTGRES_PASSWORD=mysecretpassword
-e PGDATA=/var/lib/postgresql/data/pgdata
-v /custom/mount:/var/lib/postgresql/data
postgres
This is an environment variable that is not Docker specific. Because the variable is used by the postgres server binary (see the PostgreSQL docs), the entrypoint script takes it into account.
According to this: https://www.postgresql.org/message-id/12168.1312921709%40sss.pgh.pa.us
it is not possible to mount "data" dir directly as for example longhorn volume in kubernetes so I should mount the parent folder, but according to
https://github.com/docker-library/postgres/blob/master/14/alpine/Dockerfile
line 155
VOLUME /var/lib/postgresql/data
it does not work to mount it, because then it only contains an empty "data" folder (next to the lost+found one) and the actuall database is then mounted separately into an anonymous volume and therefore lost on container restart.
So what is the solution?
The text was updated successfully, but these errors were encountered: