Thanks, this solutions works for me, create 2 databases defined in POSTGRES_MULTIPLE_DATABASES, but still creates another database with variable name POSTGRES_USER variable. ¿How can avoid create this default db?
Documentation:
POSTGRES_DB
This optional environment variable can be used to define a different name for the default database that is created when the image is first started. If it is not specified, then the value of POSTGRES_USER will be used.
The server seems to shut down when the DBs are created
Multiple databases created
LOG: received fast shutdown request
waiting for server to shut down...LOG: aborting any active transactions
LOG: autovacuum launcher shutting down
.LOG: shutting down
LOG: database system is shut down
done
server stopped
PostgreSQL init process complete; ready for start up.
Anyone ever run into permission issues running the script?
For example:
server started
/usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/create-multiple-postgres-databases.sh
/usr/local/bin/docker-entrypoint.sh: /docker-entrypoint-initdb.d/create-multiple-postgres-databases.sh: /bin/bash: bad interpreter: Permission denied
Well... in case any other poor soul stumbles onto this problem, you have to set the script as executable because Docker copies over permissions...
I created an account just to thank you
😂 Your welcome!
I also created an account just to thank you
i've already done that. but still no database created
Thanks, this solutions works for me, create 2 databases defined in POSTGRES_MULTIPLE_DATABASES, but still creates another database with variable name POSTGRES_USER variable. ¿How can avoid create this default db?
Documentation:
The server seems to shut down when the DBs are created
Multiple databases created
LOG: received fast shutdown request
waiting for server to shut down...LOG: aborting any active transactions
LOG: autovacuum launcher shutting down
.LOG: shutting down
LOG: database system is shut down
done
server stopped
PostgreSQL init process complete; ready for start up.
Thanks for sharing this!
Wondering if you found anything else since you wrote this article that may be helpful or did you end up sticking with the approach you wrote here?