sameersbn/docker-postgresql

Unable to start after replication

qnm opened this issue · 2 comments

qnm commented

I'm running a replication as follows:

# docker run --name postgres -itd --restart always \
>   --volume /var/lib/postgresql:/var/lib/postgresql \
>   --env 'PG_PASSWORD=mypass' \
>   --env 'REPLICATION_MODE=slave' --env 'REPLICATION_SSLMODE=prefer' \
>   --env 'REPLICATION_HOST=ch18' --env 'REPLICATION_PORT=5432'  \
>   --env 'REPLICATION_USER=replication' --env 'REPLICATION_PASS=mypass' \
>   --env 'PG_TRUST_LOCALNET=true' \
>   sameersbn/postgresql:latest

Which results in the following

# docker logs -f postgres
Initializing datadir...
Initializing certdir...
Initializing logdir...
Initializing rundir...
Setting resolv.conf ACLs...
Waiting for ch18 to accept connections (60s timeout)
Replicating initial data from ch18...
‣ Setting postgresql.conf parameter: data_directory = '/var/lib/postgresql/9.6/main'
‣ Setting postgresql.conf parameter: log_directory = '/var/log/postgresql'
‣ Setting postgresql.conf parameter: log_filename = 'postgresql-9.6-main.log'
Trusting connections from the local network...
Configuring recovery...
‣ Setting postgresql.conf parameter: ssl = 'off'
pg_ctl: could not start server
Examine the log output.

So I attempt to start the server manually and see:

# docker exec -it postgres sudo -u postgres service postgresql start
Error: Invalid data directory
 * No PostgreSQL clusters exist; see "man pg_createcluster"

What am I missing?

What was the solution here? I have the same error on my slave container on sameersbn/postgresql:12-20200524

Same error here. Any solution? 🙂