I spent the last hour checking the config files are indeed being used –– and they are. :P I'm getting silly after days of this configuration nightmare. Thanks for replying to all my posts and making helpful suggestions. After reading a bit more about log outputs, I enabled the maximum logging, and I think I am seeing something interesting in the logs:
When the startup command –– CMD in Docker lingo –– is "postgres" it does a bunch of initialization operations, and then runs the user procided scripts in the /docker-entrypoint-initdb.d directory.
Then finally it starts up the postgres process with /gosu postgres "$@". / The gosu is a wrapper that passes user commands to the end process, i.e. postgres, and I'm not sure what $@ is but I think it's to give the user a shell.
I do not have time to go through all the scripts, but wanna make a bet that it is starting Postgres with a different set up conf files then you think or a different instance of Postgres:)?
On your primary I would confirm what is actually run when all the scripting is done. Also when the primary is running take a look at