Skip to content

Improve handling of errors in init scripts docker-entrypoint-initdb.d  #891

@olivierdalang

Description

@olivierdalang

Currently, scripts under docker-entrypoint-initdb.d are run with -v ON_ERROR_STOP=1.

This seems sensible, as we by default don't want a the DB to initialize to an indeterminate state with silently failing init scripts. However, even if the container stops, the volume is still initialized, so that on the next restart (which will happen silently in most use cases due to restart policies), the database will start without complaints, with a partially initialized database.

Suggested fixes :

  • wipe the database if init scripts fail, so that a running container guarantees the database was successfully initialized
  • add an option (env var) to run scripts with -v ON_ERROR_STOP=0 for users who still want to continue even if scripts errors (see Stop the container if running docker-entrypoint-initdb.d scripts error out #432 (comment)), in which case failing fast on errors is damaging (e.g. when including a partially compatible database dump)

Metadata

Metadata

Assignees

No one assigned

    Labels

    RequestRequest for image modification or feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions