-
-
Notifications
You must be signed in to change notification settings - Fork 184
PGDATA forced to default location #1611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I am confused about this line: https://github.com/supabase/postgres/blob/develop/Dockerfile-15#L229 |
=> FAIL
=> WORKS Provinding Why would |
Just read through the Dockerfile, so I might be missing something. All the configs are copied from And in this postgresql.conf file which is copied to the image, data_directory is hard coded to
I'm assuming that when you override the image args, you setup postgres container with default postgres config so it works but you lose the supabase customized config. |
The issue I see is that if a user provides But that's an interesting finding and that means the issue is how the postgres.conf is generated/pathed. I feel it would make more sense to bring whatever config into the PGDATA specified by the user when the DB is initialized but I am surely missing something. |
Let me clarify. postgres entrypoint is If you look at Now, in supabase postgres repo's Dockerfile the CMD is set to The simplest solution is to modify the image’s entrypoint to update the data_directory inside postgresql.conf dynamically Here is an example. I just used services:
db:
image: supabase/postgres:15.8.1.060
ports:
- 5432:5432
entrypoint: /bin/bash -c "
sed -i \"s|data_directory.*|data_directory = '/data'|\" /etc/postgresql/postgresql.conf && \
exec docker-entrypoint.sh postgres -D /etc/postgresql
"
environment:
POSTGRES_PASSWORD: password
PGDATA: /data
volumes:
- ./data:/data |
Bug report
Describe the bug
The image forces
PGDATA
to be the default location:/var/lib/postgresql/data
and fail it is overriden.If the user defines
PGDATA
to another location, it is ignored and the container will fail starting.Here is an output with
PGDATA=/var/lib/postgresql/data/pgdata
(NOTE the extra non standard/pgdata
at the end):To Reproduce
You can test using docker and:
It will fail mentioning:
which should not be relevant since we want to use
/data
.Expected behavior
The user can point to a custom PGDATA and the container starts.
Using the original postgres image works fine:
System information
but the issue is not specific to this version.
The text was updated successfully, but these errors were encountered: