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
genuinely thank you so much for this, I had been stuck troubleshooting this problem. I would recommend to also put the error on the title for better visibility, I did not realize this was the whole culprit after all.
for those that only needed to create specific database(s)/user(s) (with passwords) and is able to mount the script to docker-entrypoint-initdb.d/:
#!/bin/bashset -e
set -u
echo"setting up";
PGPASSWORD="${POSTGRES_PASSWORD}" psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB"<<-EOSQL CREATE USER ... PASSWORD '...'; CREATE DATABASE ...; GRANT ALL PRIVILEGES ON DATABASE ... TO ...; -- you can copy paste multiple of these commands if you need toEOSQLecho"setup done";
this setup requires to set POSTGRES_PASSWORD, POSTGRES_USER and POSTGRES_DATABASE. works on postgresql 16.
juhi24
changed the title
Postgres 16 compatibility
Postgres 16 compatibility (FATAL: database does not exist)
Oct 14, 2024
Using a reasonably new version of postgres image (tried 16-alpine), you would get a
See https://dev.to/nietzscheson/multiples-postgres-databases-in-one-service-with-docker-compose-4fdf#comment-2fd1m for further discussion and a possible workaround.
The text was updated successfully, but these errors were encountered: