My question can be naive, but I'm new to development and docker, and couldn't figure out the solution. I have an image of GraphDB-Free which I can run as a docker container, and it runs on localhost:7200. I can access it in chrome also.
Now I have another module ModelService which is spring boot application to read and write data to the GraphDB. I created an image of the module and ran it as a docker container, but everytime it gives me a Connection Refused error like the following:
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:7200 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
.
This problem is only If I run the module ModelService by using a docker container. If I run it as a simple java application from intelliJ, it runs fine and gets connected with GraphDB instance that I ran inside a container.
This ModelService module starts a springboot application and has a application.properties
file that specifies it to connect with GraphDB using register.graphDbUrl=http://localhost:7200
and register.repositoryId=SYSTEM
.
I believe I'm missing something with Docker containers. I don't want to use Docker-Compose, and point is to run both containers as stand alone containers. I have tried --link
while running docker run but it doesn't helps.
I run the GDB instance using docker run -p 7200:7200 graphDB-image
, and ModelService using docker run -p 9001:8080 modelService-image
. I do wait before the GraphDB is completey up and running, and then I run other container.
Can somebody help in this. I've struggling with it for 2 days.