in this question, I refer to the answer to the following question: here.I have two docker container. In one I have my database and in the other a jenkins server. The latter was already created and is running. My docker container for my database is created as follows:
docker run -d --name postgres -e POSTGRES_USER=user -e POSTGRES_PASSWORD=password -e POSTGRES_DB=postgres -p 127.0.0.1:5432:5432 postgres:10.4-alpine
Then I created a nework via
docker network create --driver=bridge postgres_jenkins_network
and put both container in this network with
docker network connect postgres_jenkins_network postgres
docker network connect postgres_jenkins_network jenkins
Unfortunately, my jenkins is not able to connect to my postgres database, since I get the following error:
org.postgresql.util.PSQLException: Connection to localhost:5432 refused
My Application which is tested by jenkins has the following application properties and yml data:
application.properties
spring.profiles.active=dev
application.yml
spring:
profiles: dev
datasource:
platform: postgres
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://localhost:5432/postgres
username: user
password: password
server:
servlet:
context-path: /mep
port: 9000
It seems, that my application get no access to my database but I have no idea why this is the case.
Thanks for any help Matthias