echo "create table test (gid integer);" > setup-db.sql
docker run --name testdb -d -v `pwd`/setup-db.sql:/docker-entrypoint-initdb.d/setup-db.sql kartoza/postgis:16
docker exec testdb ls -A /docker-entrypoint-initdb.d
# setup-db.sql
docker exec testdb ls -A /docker-entrypoint.initdb.d
# .entry_point.lock
Versions
Starting from 14 to latest, 13 isn't affected
Trying to mount a directory of sql scripts as a volume to this target dir, and want to preserve the lockfile in future containers where pgdata volume already exists (in order to avoid re-init db).
What is the bug or the crash?
The default value here https://github.com/kartoza/docker-postgis/blob/7d7c5946db0c6b8a55ec228cfd205791ef5e95ca/scripts/env-data.sh#L9 is different that the one in the docs (or the official postgres image), it should be
docker-entrypoint-initdb.d
.This results in a lockfile created in the wrong path, thus it won't get cached in case this directory is used as a volume.
Steps to reproduce the issue
Versions
Starting from 14 to latest, 13 isn't affected
Trying to mount a directory of sql scripts as a volume to this target dir, and want to preserve the lockfile in future containers where pgdata volume already exists (in order to avoid re-init db).