docker-library / postgres

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

Run database initialization after startup #1196

Closed benno-mueller-saxess closed 3 months ago

benno-mueller-saxess commented 4 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 4 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).