Skip to content

Can't populate database via sh script #603

Closed
@alexeyd-itsoft

Description

@alexeyd-itsoft

Have faced with the issue that our sh script doesn't work anymore. it worked until 9.6.8

As far as I have understood the root of the issue is

# diff -u docker-entrypoint.sh-967 docker-entrypoint.sh-968
--- docker-entrypoint.sh-967  2018-02-17 00:27:18.000000000 +0200
+++ docker-entrypoint.sh-968  2018-05-09 21:01:04.000000000 +0300
@@ -95,7 +95,7 @@
     # does not listen on external TCP/IP and waits until start finishes
     PGUSER="${PGUSER:-postgres}" \
     pg_ctl -D "$PGDATA" \
-      -o "-c listen_addresses='localhost'" \
+      -o "-c listen_addresses=''" \
       -w start

Our script has the following check

check1_result=$(psql --host=localhost --port=5432 --version > /dev/null 2>&1)
check2_result=$(psql --host=localhost --port=5432 -l > /dev/null 2>&1)

if [[ ${check1_result} -eq 0 && ${check2_result} -eq 0 ]]; then
   # create db and users
fi

In the console I get the following error

postgresql    | psql: could not connect to server: Connection refused
postgresql    | 	Is the server running on host "localhost" (127.0.0.1) and accepting
postgresql    | 	TCP/IP connections on port 5432?

I there any workaround? Unfortunately I can't update the script

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionUsability question, not directly related to an error with the image

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions