© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
1 reply
madsbuch

Initializing docker database

We use supabase, and really want to use the database in our CI env!

We already have exported the data from our dev environment to the
preview_data.sql
preview_data.sql
file and try to start the database with following docker-compose service entry:
  database:
    image: supabase/postgres:latest
    ports:
      - 5432:5432
    command: postgres -c config_file=/etc/postgresql/postgresql.conf 
    volumes:
      - ./data/preview_data.sql:/docker-entrypoint-initdb.d/preview_data.sql
    environment:
      POSTGRES_PASSWORD: postgres
  database:
    image: supabase/postgres:latest
    ports:
      - 5432:5432
    command: postgres -c config_file=/etc/postgresql/postgresql.conf 
    volumes:
      - ./data/preview_data.sql:/docker-entrypoint-initdb.d/preview_data.sql
    environment:
      POSTGRES_PASSWORD: postgres


it fails:

database_1  | [local] 2022-09-07 12:46:16.815 UTC [70] postgres@postgres ERROR:  role "supabase_admin" does not exist
database_1  | [local] 2022-09-07 12:46:16.815 UTC [70] postgres@postgres STATEMENT:  ALTER SCHEMA auth OWNER TO supabase_admin;
database_1  | psql:/docker-entrypoint-initdb.d/preview_data.sql:26: ERROR:  role "supabase_admin" does not exist
preview-infrastructure_database_1 exited with code 3
database_1  | [local] 2022-09-07 12:46:16.815 UTC [70] postgres@postgres ERROR:  role "supabase_admin" does not exist
database_1  | [local] 2022-09-07 12:46:16.815 UTC [70] postgres@postgres STATEMENT:  ALTER SCHEMA auth OWNER TO supabase_admin;
database_1  | psql:/docker-entrypoint-initdb.d/preview_data.sql:26: ERROR:  role "supabase_admin" does not exist
preview-infrastructure_database_1 exited with code 3


However, it seems like this role is being set up after files from the
docker-entrypoint-initdb.d
docker-entrypoint-initdb.d
folder is being executed. When we use
psql postgres://postgres:postgres@localhost -f ./data/preview_data.sql
psql postgres://postgres:postgres@localhost -f ./data/preview_data.sql
it works flawlessly!

Anyone with suggestions to getting the file in
docker-entrypoint-initdb.d
docker-entrypoint-initdb.d
to work?
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Docker self hosted database keeps resetting
SupabaseSSupabase / help-and-questions
4y ago
Supabase docker keep database on update
SupabaseSSupabase / help-and-questions
4y ago
DatabaseLackOfConnections
SupabaseSSupabase / help-and-questions
5mo ago
Struggle to make docker setup working with an external database
SupabaseSSupabase / help-and-questions
4y ago