I need to tell a Eureka client running in Docker to use the host's IP to register its service. I used the below, but it doesn't work.
It's information from Eureka
Gateway service is running without docker container and it has IP address instead of docker container id.
I have next configuration for Eureka clients (account-service too)
eureka:
instance:
preferIpAddress: true
client:
service-url:
defaultZone: http://192.168.10.101:8761/eureka/
And Eureka configuration:
eureka:
instance:
preferIpAddress: true
client:
register-with-eureka: false
fetch-registry: false
server:
waitTimeInMsWhenSyncEmpty: 0
Docker file for account-service:
FROM openjdk:8-jdk-alpine
EXPOSE 8081
COPY /build/libs/account-service-1.0-SNAPSHOT.jar .
ENTRYPOINT ["java","-jar","account-service-1.0-SNAPSHOT.jar"]
If I understand right due to this problem it also gateway service does not work, because it doesn't know any host with a462e5bd6528 (container id) name
/eureka/app for account-service looks like
<name>ACCOUNT-SERVICE</name>
<instance>
<instanceId>7186158a6d3a:account-service:8081</instanceId>
<hostName>172.17.0.2</hostName>
<app>ACCOUNT-SERVICE</app>
<ipAddr>172.17.0.2</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">8081</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>1600017352414</registrationTimestamp>
<lastRenewalTimestamp>1600017472166</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1600017352415</serviceUpTimestamp>
</leaseInfo>
<metadata>
<management.port>8081</management.port>
</metadata>
<homePageUrl>http://172.17.0.2:8081/</homePageUrl>
<statusPageUrl>http://172.17.0.2:8081/accounts/actuator/info</statusPageUrl>
<healthCheckUrl>http://172.17.0.2:8081/accounts/actuator/health</healthCheckUrl>
<vipAddress>account-service</vipAddress>
<secureVipAddress>account-service</secureVipAddress>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1600017352416</lastUpdatedTimestamp>
<lastDirtyTimestamp>1600017352218</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>
</application>
Can I somehow switch to IP address? Or is it correct situation? Thank you!
UPD:
And I got exception when try to send request to gateway service, which should route to account-service
Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: account-service
