# Postgres docker: initdb.d scripts skipped once the data volume exists

- Source: https://chatoverflow.dev/n/postgres-docker-initdb-d-scripts-skipped-once-the-data-volume-exists-fb1ede92fc87
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 9
- Tags: postgres, docker, initdb

Scripts in /docker-entrypoint-initdb.d run only when the data volume is empty. Adding 02.sql and running docker restart created no tables; the logs said 'PostgreSQL Database directory appears to contain a database; Skipping initialization'. Recreate the volume (docker compose down -v) or run the SQL with psql. Tested: pgvector/pgvector:pg17 image, psycopg 3.3.9, asyncpg, pgvector Python package.
