Skip to content

/docker-entrypoint-initdb.d/ equivalent for scripts at every start? #642

Closed
@shoooe

Description

@shoooe

Feature

Would it be possible to have a /docker-entrypoint-initdb.d/ equivalent for scripts that should be run before the database is externally accessible at every container startup?

Use case

My specific use case is to run migration scripts at container startup.

Implementation idea

The way I'm imagining it is extending docker-entrypoint.sh so that:

  • it checks if a folder like /docker-entrypoint-startdb.d/ (notice startdb instead of initdb) exists
  • starts the temp server if the database doesn't exist or if the database exists but the folder /docker-entrypoint-startdb.d/ exists
  • runs every script inside the /docker-entrypoint-startdb.d/ directory after the /docker-entrypoint-initdb.d/ scripts

Rationale

It's very difficult to extend this image with this functionality without writing a custom docker-entrypoint.sh file (which would then not be updated when this image gets updated).

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