timescale / timescaledb-docker

Release Docker builds of TimescaleDB
Apache License 2.0
295 stars 130 forks source link

Using docker timescale/timescaledb image, 'CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;' fails as it is not preloaded #234

Closed gitmalong closed 8 months ago

gitmalong commented 8 months ago

Docker compose

version: '3.8'
services:
  db:
    build: 
      context: .
      dockerfile: Dockerfile
    ulimits:
      nofile:
        soft: 325536
        hard: 325536
    shm_size: 12g
    restart: always
    command: >
      su - postgres -c '
      postgres 
      -c 'max_connections=200' 
      -c 'effective_io_concurrency=200' 
      -c 'work_mem=3GB'
      -c 'shared_buffers=2GB' 
      -c 'effective_cache_size=8GB' 
      -c 'max_wal_size=14GB' 
      -c 'checkpoint_timeout=20min' 
      -c 'max_parallel_workers_per_gather=8'    
      -c 'log_statement=all'
      --config-file=/var/lib/postgresql/data/postgresql.conf
      -D /var/lib/postgresql/data
      '
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=pos_zon9onnnouftgres
      - PGDATA=/var/lib/postgresql/data
    ports:
      - '5431:5432'
    volumes: 
      - ./docker/postgresql:/var/lib/postgresql/data
      - ./init_db.sh:/docker-entrypoint-initdb.d/init_db.sh
volumes:
  db:
    driver: local

Dockerfile

FROM timescale/timescaledb:latest-pg16

When trying to create a hypertable: Execution Error: error returned from database: extension "timescaledb" must be preloaded

The error also appears when adding this to the Dockerfile

RUN echo "shared_preload_libraries = 'timescaledb'" >> /var/lib/postgresql/data/postgresql.conf

gitmalong commented 8 months ago

nevermind.