I think the key error is on line 63 of the gist you posted. For some reason, it is interpreting file bind mount as a directory and not as a file. If I run the default docker compose file here, and start up the db container, this is the log output I get:
$ docker logs db
Add rule to pg_hba:
0.0.0.0/0Add rule to pg_hba: replication replicator
Setup master database
2020-03-04 00:28:12.848 UTC [25] LOG: starting PostgreSQL 12.1 (Debian 12.1-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
2020-03-04 00:28:12.849 UTC [25] LOG: listening on IPv4 address "127.0.0.1", port 5432
2020-03-04 00:28:12.855 UTC [25] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-03-04 00:28:12.928 UTC [36] LOG: database system was shut down at 2019-12-03 16:35:30 UTC
2020-03-04 00:28:12.931 UTC [37] postgres@postgres FATAL: the database system is starting up
psql: error: could not connect to server: FATAL: the database system is starting up
2020-03-04 00:28:12.948 UTC [25] LOG: database system is ready to accept connections
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+---------+---------+-----------------------
postgres | postgres | UTF8 | C.UTF-8 | C.UTF-8 |
template0 | postgres | UTF8 | C.UTF-8 | C.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | C.UTF-8 | C.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(3 rows)
postgres ready
Setup postgres User:Password
Creating superuser postgres
ALTER ROLE
Creating replication user replicator
CREATE ROLE
postgres db already exists
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+---------+---------+-----------------------
postgres | postgres | UTF8 | C.UTF-8 | C.UTF-8 |
template0 | postgres | UTF8 | C.UTF-8 | C.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | C.UTF-8 | C.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(3 rows)
/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/init.sql
CREATE DATABASE
UPDATE 1
You are now connected to database "template_postgis" as user "postgres".
CREATE EXTENSION
GRANT
GRANT
GRANT
CREATE EXTENSION
2020-03-04 00:28:16.764 UTC [25] LOG: received smart shutdown request
2020-03-04 00:28:16.783 UTC [25] LOG: background worker "logical replication launcher" (PID 44) exited with exit code 1
2020-03-04 00:28:16.791 UTC [39] LOG: shutting down
2020-03-04 00:28:16.866 UTC [25] LOG: database system is shut down
Postgres initialisation process completed .... restarting in foreground
Why it is different for you I cannot tell right now. I'm using docker-compose version 1.24.1 (docker engine 19.03.5).