Assuming the following docker-compose.yml:
version: '3'
services:
db:
image: postgres:12
restart: always
environment:
- POSTGRES_USER=root
- POSTGRES_PASSWORD=password
volumes:
- ./postgres:/docker-entrypoint-initdb.d/
ports:
- 5420:5420
With the knowledge of: How can I import a JSON file into PostgreSQL? to load data from a json file into Postgres... i.e:
sql> \set content `cat /tmp/test.json`
sql> create temp table t ( j jsonb );
sql> insert into t values (:'content');
sql> select * from t;
How do I ensure that I my initialize script can see the .json files when executing cat /tmp/test.json
inside docker?