This is related to a question that I already put on Stack Overflow here: postgresql - DOCKER container with postgres, WARNING: could not open statistics file "pg_stat_tmp/global.stat": Operation not permitted - Stack Overflow
I have a bunch of docker containers setup, and the postgres containers always shows these warnings:
2021-11-25 15:18:55.777 UTC  WARNING: could not open statistics file “pg_stat_tmp/global.stat”: Operation not permitted, whether using Mac OS or LINUX.
In my docker-compose.yml I have something like:
# Postgres Service for pacs-butterfly postgres_butterfly: image: postgres:13 ports: ["5557:5432"] restart: unless-stopped volumes: - ./OrthancButterFlyIndex:/var/lib/postgresql/data environment: TZ: "America/Cayman" PGTZ: "America/Cayman" POSTGRES_PASSWORD: "postgres"
so the database is bound to a local folder, not to a volume.
It seems most likely that the issue is related to a permissions problems, but not sure how best to resolve that.
On linux, the pg_stat_tmp folder has 700 permissions and is owned by systemd-coredump, and files in that directory have 600 permissions and same owner and group.