So this is the content of my /docker-entrypoint-initdb.d/initdb.sql script:
CREATE DATABASE mynewdatabase;
CREATE EXTENSION IF NOT EXISTS pgcrypto;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
then I mount the volumes in docker:
postgres:
image: docker.io/bitnami/postgresql:11
ports:
- 5432:5432
environment:
- POSTGRES_PASSWORD=postgres
- POSTGRESQL_USERNAME=postgres
volumes:
- ./db/create-db.sql:/docker-entrypoint-initdb.d/create-db.sql
The script is executed successfully, however the extensions are only accessible in the postgres default database
I have tried using something like:
CREATE EXTENSION IF NOT EXISTS "uuid-ossp" FROM/WITH;
But it did not work as expected