timescale/timescaledb-docker

Bitnami-based image initdb fails

ported-pw opened this issue · 1 comments

The Bitnami-based image with tag fails to start because of an issue in the(https://github.com/timescale/timescaledb-docker/blob/main/docker-entrypoint-initdb.d/000_install_timescaledb.sh script:

timescale_test-postgresql-1  | postgresql 19:50:25.69 
timescale_test-postgresql-1  | postgresql 19:50:25.69 Welcome to the Bitnami postgresql container
timescale_test-postgresql-1  | postgresql 19:50:25.69 Subscribe to project updates by watching https://github.com/bitnami/containers
timescale_test-postgresql-1  | postgresql 19:50:25.69 Submit issues and feature requests at https://github.com/bitnami/containers/issues
timescale_test-postgresql-1  | postgresql 19:50:25.69 
timescale_test-postgresql-1  | postgresql 19:50:25.70 INFO  ==> ** Starting PostgreSQL setup **
timescale_test-postgresql-1  | postgresql 19:50:25.72 INFO  ==> Validating settings in POSTGRESQL_* env vars..
timescale_test-postgresql-1  | postgresql 19:50:25.72 INFO  ==> Loading custom pre-init scripts...
timescale_test-postgresql-1  | postgresql 19:50:25.72 INFO  ==> Initializing PostgreSQL database...
timescale_test-postgresql-1  | postgresql 19:50:25.74 INFO  ==> pg_hba.conf file not detected. Generating it...
timescale_test-postgresql-1  | postgresql 19:50:25.74 INFO  ==> Generating local authentication configuration
timescale_test-postgresql-1  | postgresql 19:50:26.52 INFO  ==> Starting PostgreSQL in background...
timescale_test-postgresql-1  | postgresql 19:50:27.04 INFO  ==> Creating user test
timescale_test-postgresql-1  | postgresql 19:50:27.05 INFO  ==> Granting access to "test" to the database "test"
timescale_test-postgresql-1  | postgresql 19:50:27.07 INFO  ==> Setting ownership for the 'public' schema database "test" to "test"
timescale_test-postgresql-1  | postgresql 19:50:27.09 INFO  ==> Creating replication user replication
timescale_test-postgresql-1  | postgresql 19:50:27.10 INFO  ==> Configuring replication parameters
timescale_test-postgresql-1  | postgresql 19:50:27.12 INFO  ==> Configuring synchronous_replication
timescale_test-postgresql-1  | postgresql 19:50:27.12 INFO  ==> Configuring fsync
timescale_test-postgresql-1  | postgresql 19:50:27.14 INFO  ==> Loading custom scripts...
timescale_test-postgresql-1  | postgresql 19:50:27.14 INFO  ==> Loading user's custom files from /docker-entrypoint-initdb.d ...
timescale_test-postgresql-1  | postgresql 19:50:27.14 INFO  ==> Starting PostgreSQL in background...
timescale_test-postgresql-1  | /docker-entrypoint-initdb.d/000_install_timescaledb.sh: line 43: POSTGRES_USER: unbound variable
timescale_test-postgresql-1  | postgresql 19:50:27.15 INFO  ==> Stopping PostgreSQL...
timescale_test-postgresql-1  | waiting for server to shut down.... done
timescale_test-postgresql-1  | server stopped
timescale_test-postgresql-1 exited with code 1

On the newer images, BITNAMI_IMAGE_VERSION seems to not be set, making the check in the script not detect the fact that it is a Bitnami image and consequently correctly assign the environment variables.

postgres@efb4a7d7b29b:/$ printenv | grep BITNAMI
BITNAMI_ROOT_DIR=/opt/bitnami
BITNAMI_DEBUG=false
BITNAMI_VOLUME_DIR=/bitnami
BITNAMI_APP_NAME=postgresql

Hello @ported-pw,

Thank you very much for reporting the problem. I was able to reproduce the problem with the container image timescale/timescaledb:2.8.0-pg14-bitnami.

$ docker run -d --name timescaledb -e POSTGRES_PASSWORD=password timescale/timescaledb:2.8.0-pg14-bitnami
$ docker logs -f timescaledb
postgresql 12:21:49.92 
postgresql 12:21:49.93 Welcome to the Bitnami postgresql container
postgresql 12:21:49.93 Subscribe to project updates by watching https://github.com/bitnami/containers
postgresql 12:21:49.93 Submit issues and feature requests at https://github.com/bitnami/containers/issues
postgresql 12:21:49.93 
postgresql 12:21:49.95 INFO  ==> ** Starting PostgreSQL setup **
postgresql 12:21:49.97 INFO  ==> Validating settings in POSTGRESQL_* env vars..
postgresql 12:21:49.98 INFO  ==> Loading custom pre-init scripts...
postgresql 12:21:49.98 INFO  ==> Initializing PostgreSQL database...
postgresql 12:21:50.00 INFO  ==> pg_hba.conf file not detected. Generating it...
postgresql 12:21:50.00 INFO  ==> Generating local authentication configuration
postgresql 12:21:51.58 INFO  ==> Starting PostgreSQL in background...
postgresql 12:21:51.84 INFO  ==> Changing password of postgres
postgresql 12:21:51.87 INFO  ==> Configuring replication parameters
postgresql 12:21:51.90 INFO  ==> Configuring synchronous_replication
postgresql 12:21:51.90 INFO  ==> Configuring fsync
postgresql 12:21:51.92 INFO  ==> Loading custom scripts...
postgresql 12:21:51.93 INFO  ==> Loading user's custom files from /docker-entrypoint-initdb.d ...
postgresql 12:21:51.93 INFO  ==> Starting PostgreSQL in background...
/docker-entrypoint-initdb.d/000_install_timescaledb.sh: line 43: POSTGRES_USER: unbound variable
postgresql 12:21:51.94 INFO  ==> Stopping PostgreSQL...
waiting for server to shut down.... done
server stopped
$ export
export APP_VERSION='14.5.0'
export BITNAMI_APP_NAME='postgresql'
export HOME='/'
export HOSTNAME='84da66c946ef'
export LANG='en_US.UTF-8'
export LANGUAGE='en_US:en'
export NSS_WRAPPER_LIB='/opt/bitnami/common/lib/libnss_wrapper.so'
export OS_ARCH='amd64'
export OS_FLAVOUR='debian-11'
export OS_NAME='linux'
export PATH='/opt/bitnami/common/bin:/opt/bitnami/postgresql/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
export PWD='/'
export TERM='xterm'