Skip to content

Add the ability to execute entrypoints on a start #821

Closed
@grouvig

Description

@grouvig

Hi,

We have the need to be able to execute entrypoints on each start.
As of now the only entypoint available is executed on first start with initdb: docker-entrypoint-initdb.d

To work around this, we modify your alpine image to add another entrypoint docker-entrypoint-init.d in docker-entrypoint.sh this way:

...
_main() {
	...
	if [ "$1" = 'postgres' ] && ! _pg_want_help "$@"; then
		...
		# only run initialization on an empty data directory
		if [ -z "$DATABASE_ALREADY_EXISTS" ]; then
			...
			docker_process_init_files /docker-entrypoint-initdb.d/*
			...
		else
			...
		fi
		echo "Process custom init file "
		docker_process_init_files /docker-entrypoint-init.d/*
		echo "Process custom init file done "
	fi

	exec "$@"
}
...

Can you add such an entrypoint to the image ?
This will allow to restore db from volumes on start, make additional configurations...

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