docker-library / postgres

Docker Official Image packaging for Postgres
http://www.postgresql.org
MIT License
2.2k stars 1.14k forks source link

Run database initialization after startup #1196

Closed benno-mueller-saxess closed 8 months ago

benno-mueller-saxess commented 9 months ago

I want to run some database initialization script after the server has startet successfull (Log: "LOG: Datenbanksystem ist bereit, um Verbindungen anzunehmen"). I'm using currently image postgres:12.18

How can I do this with an Dockerfile?

tianon commented 9 months ago

See https://github.com/docker-library/postgres/issues/173, https://github.com/docker-library/postgres/issues/821, https://github.com/docker-library/postgres/issues/191, https://github.com/docker-library/postgres/issues/929 for some other issues that have some good thoughts / suggestions (one of/many of which this is probably a solid duplicate of).