Skip to content

How to script adding a new User/Database to an existing database instance? #945

@nodje

Description

@nodje

I must be the nth person asking for this, but I can find a solution for this anywhere.

Since, as per the doc, Warning: scripts in /docker-entrypoint-initdb.d are only run if you start the container with a data directory that is empty; any pre-existing database will be left untouched on container startup,it seems there is no way to add a script to /docker-entrypoint-initdb.d to create a new User/Database couple when you add, say a new container to a docker-compose file and want to share a single postgres instance.

Or am I understanding this wrong?

In anycase, in my tests I get a PostgreSQL Database directory appears to contain a database; Skipping initialization in the logs, confirming the behaviour.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionUsability question, not directly related to an error with the image

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions