Edit: Title error = ‘psql: could not connect to server: Connection refused Is the server running on host “172.19.0.2” and accepting TCP/IP connections on port 5432?’
I’m currently trying to run fossology in Gitlab CI. Fossology requires an external database that can be set up from a schema created using pg_dump.
At the moment, I have a script that sets up a container that runs the required version of postgres (9.6). It then tries to run an .sql script via psql. Upon doing so it gets the title error.
These scripts have worked fine when doing the exact same thing from the command line, I’m not sure where the issue is coming from or how to solve it.
Here is the script:
#!/bin/bash docker network create --driver bridge foss-net docker volume create --name vol # to mount volume: -v vol:/db echo starting container docker run -d --name fossdb -p 5432:5432 --network foss-net postgres:9.6 echo copying files... docker cp $CREATE_BLANK fossdb:/createBlank.sql docker cp $SCHEMA fossdb:/schema.sql echo creating blank db docker exec fossdb psql -f ./createBlank.sql -U postgres echo building from schema docker exec fossdb psql fossology < ./schema.sql -U postgres
I have tried specifying a port and a host when using psql but the same error persists.