clair: Connection refused between docker container of clair and pgsql
When I try to run the docker container of clair, there is something wrong with the connection to my pgsql. The docker logs are quoted as follows.
2016-04-05 10:27:47.078096 I | pgsql: running database migrations
2016-04-05 10:27:47.079614 E | pgsql: dial tcp [::1]:5432: getsockopt: connection refused
2016-04-05 10:27:47.079655 C | main: database: could not open database
I have tried several ways and on different machines and the issue still exists.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 20 (9 by maintainers)
Commits related to this issue
- config: not properly loaded error When a wrong config file was used, it result in a panic. Adding some check condition to validate the Unmarshaled configuration before using it fixes #134 — committed to jgsqware/clair by deleted user 8 years ago
- config: not properly loaded error (#140) * config: not properly loaded error When a wrong config file was used, it result in a panic. Adding some check condition to validate the Unmarshaled confi... — committed to quay/clair by deleted user 8 years ago
Faced the same problem. Figured out that connection URL to the database should not be
localhost
or127.0.0.1
. It should be URL to your container with the Postgres. So the easiest way to do it is to define something likecontainer_name: clair_postgres
in the docker-compose.yml and use it as a connection stringpostgresql://postgres:password@clair_postgres:5432?sslmode=disable
Did you fill the pgsql setting in your config.yaml file and started with it?