Rest 不同docker容器中运行的Spring boot应用程序拒绝连接

Rest 不同docker容器中运行的Spring boot应用程序拒绝连接,rest,spring-boot,docker,Rest,Spring Boot,Docker,我有三个应用程序在同一台主机上的3个容器中运行 CONTAINER ID IMAGE COMMAND PORTS 3f938111c1bf registration "java -jar registration.jar" 0.0.0.0:8030->8030/tcp cb9c4782194e security "java -j

我有三个应用程序在同一台主机上的3个容器中运行

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   
我能够使用Ajax请求从主应用程序访问安全应用程序的端点

注册应用程序使用RestTemplate对象从java方法调用security app的端点。安全应用程序拒绝此呼叫,如下所示

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)
我无法确定这个问题请注意,当我通过eclipse在本地运行这些应用程序时,这个调用运行得非常好。

我对码头工人很陌生。有没有可能我遗漏了什么?任何线索都会有帮助


非常感谢

使用docker容器/图像时,需要对其进行配置。因此,您必须将localhost更改为您的容器名称。例如:

 http://localhost:8020/security/register

 http://authentication:8020/security/register
酷!:)@阿比纳夫普拉卡什