I have three apps running in 3 containers on the same host.
CONTAINER ID IMAGE COMMAND PORTS
3f938111c1bf registration "java -jar registration.jar" 0.0.0.0:8030->8030/tcp
cb9c4782194e security "java -jar security.jar" 0.0.0.0:8020->8020/tcp
60005507a246 main "java -jar main.jar" 0.0.0.0:8000->8000/tcp
I am able to access an endpoint of the security app from main app using an Ajax request.
The registration app calls an endpoint of security app from a java method using a RestTemplate object. This call is refused by the security app as follows.
I/O error on POST request for "http://localhost:8020/security/register": Connect to localhost:8020 [localhost/127.0.0.1] failed: Connection refused (Connection refused); nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:8020 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
I am not able to identify the issue. Note that this call is working perfectly fine when I run these apps locally through eclipse.
I am very new to the dockers. Is there a possibility that I am missing out something? Any leads would be helpful.
Thanks a lot!