Docker尤里卡UnknownHostException

即时通讯试图做dockerized springboot应用程序的微服务架构。

对于内部通信,我想使用Eureka + FeignClient。 与尤里卡的注册工作正常(afaik):

<application> <name>CAREER-SERVICE</name> <instance> <instanceId>4b62546fdc9b:career-service:7000</instanceId> <hostName>172.18.0.15</hostName> <app>CAREER-SERVICE</app> <ipAddr>172.18.0.15</ipAddr> <status>UP</status> <overriddenstatus>UNKNOWN</overriddenstatus> <port enabled="true">7000</port> <securePort enabled="false">443</securePort> <countryId>1</countryId> <dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo"> <name>MyOwn</name> </dataCenterInfo> <leaseInfo> <renewalIntervalInSecs>30</renewalIntervalInSecs> <durationInSecs>90</durationInSecs> <registrationTimestamp>1497345551521</registrationTimestamp> <lastRenewalTimestamp>1497347501260</lastRenewalTimestamp> <evictionTimestamp>0</evictionTimestamp> <serviceUpTimestamp>1497345550971</serviceUpTimestamp> </leaseInfo> <metadata class="java.util.Collections$EmptyMap"/> <homePageUrl>http://172.18.0.15:7000/</homePageUrl> <statusPageUrl>http://172.18.0.15:7000/info</statusPageUrl> <healthCheckUrl>http://172.18.0.15:7000/health</healthCheckUrl> <vipAddress>career-service</vipAddress> <secureVipAddress>career-service</secureVipAddress> <isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer> <lastUpdatedTimestamp>1497345551521</lastUpdatedTimestamp> <lastDirtyTimestamp>1497345550555</lastDirtyTimestamp> <actionType>ADDED</actionType> </instance> </application> <application> <name>AUTH-SERVICE</name> <instance> <instanceId>5ecc30b0fcd1:auth-service:5000</instanceId> <hostName>172.18.0.11</hostName> <app>AUTH-SERVICE</app> <ipAddr>172.18.0.11</ipAddr> <status>UP</status> <overriddenstatus>UNKNOWN</overriddenstatus> <port enabled="true">5000</port> <securePort enabled="false">443</securePort> <countryId>1</countryId> <dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo"> <name>MyOwn</name> </dataCenterInfo> <leaseInfo> <renewalIntervalInSecs>30</renewalIntervalInSecs> <durationInSecs>90</durationInSecs> <registrationTimestamp>1497345537851</registrationTimestamp> <lastRenewalTimestamp>1497347517943</lastRenewalTimestamp> <evictionTimestamp>0</evictionTimestamp> <serviceUpTimestamp>1497345536974</serviceUpTimestamp> </leaseInfo> <metadata class="java.util.Collections$EmptyMap"/> <homePageUrl>http://172.18.0.11:5000/</homePageUrl> <statusPageUrl>http://172.18.0.11:5000/info</statusPageUrl> <healthCheckUrl>http://172.18.0.11:5000/health</healthCheckUrl> <vipAddress>auth-service</vipAddress> <secureVipAddress>auth-service</secureVipAddress> <isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer> <lastUpdatedTimestamp>1497345537851</lastUpdatedTimestamp> <lastDirtyTimestamp>1497345506847</lastDirtyTimestamp> <actionType>ADDED</actionType> </instance> </application> 

在我的一个服务中,我需要访问auth-service并尝试使用接口AuthServiceClient和@FeignClient Annotation来完成:

 FeignClient(name = "auth-service") public interface AuthServiceClient { @RequestMapping(method = RequestMethod.POST, value = "/users", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) void createUser(User user); } 

当我调用该方法时,我得到以下exception:`

 account_1 | 2017-06-13 09:55:35.654 ERROR 1 --- [nio-6000-exec-6] oaccC[.[.[.[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [/accounts] threw exception [Request processing failed; nested exception is com.netflix.hystrix.exception.HystrixRuntimeException: createUser failed and no fallback available.] with root cause account_1 | account_1 | java.net.UnknownHostException: auth-service 

注册的IP是正确的我只是想知道他为什么不知道'auth服务'。 所以我想他可能甚至不想和尤里卡说话? 任何想法如何我可以这样debugging?

非常感谢您的帮助!