I'm trying to work with a Postgres container in Pipelines, adding it as service and using `psql`, but it fails for different reasons. Hence I reduced the `bitbucket-pipelines.yml` to the simplest version, but still cannot make it work:
pipelines:
default:
- step:
image: postgres:latest
script:
- psql
This returns the following:
<span>psql: could not connect to server: No such file or directory<br></span><span> Is the server running locally and accepting<br></span><span> connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?</span><span>+ psql<br></span>
I tried to find a hint among answered questions, here and on Stackoverflow, but nothing seems to work.
I would greatly appreciate if someone could help me understand what am I doing wrong.
UPDATE: Looking at the log, when starting postgres as a service, I noticed this:
<span>2018-07-09 22:45:16.472 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432<br></span><span>2018-07-09 22:45:16.472 UTC [1] LOG: listening on IPv6 address "::", port 5432<br></span><span>2018-07-09 22:45:16.476 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"</span><span>PostgreSQL init process complete; ready for start up.<br></span>
Is it correct that it's listening on the address "0.0.0.0"? I would expect that to be "127.0.0.1", according to
These services share a network adapter with your build container and all open their ports on localhost. No port mapping or hostnames are required. For example, if you were using Postgres, your tests just connect to port 5432 on localhost.
On the other hand, the log is saying that the server is listening on exactly the same Unix socket that the error message is mentioning.
Again, I would really appreciate if someone could help with this.