I have several microservices working in the Docker Data Center. I have the same Eureka configuration across all services / applications. But some of the applications are registered with their IP address eth0instead of the container identifier.
I tried to set preferIpAddresshow false, but it does not work all the time.
There is no template. The same service that is registered with the container identifier during the previous deployment is registered in IP at another time. I want my services to always register with the container identifier. Is there a way to enforce it or am I missing something?
Note. I also cleaned all the old docker images from the registry, deployment nodes, and tried from scratch.
Eureka Server Configuration:
eureka:
instance:
hostname: discovery
client:
registerWithEureka: false
fetchRegistry: false
serviceUrl:
defaultZone: http://${eureka.instance.hostname}:8761/eureka/
Microservices client configuration (it is the same for all microservices)
eureka:
client:
healthcheck:
enabled: true
serviceUrl:
defaultZone: http://discovery:8761/eureka/
instance:
preferIpAddress: false
metadataMap:
instanceId: ${vcap.application.instance_id:${spring.application.name}:${spring.application.instance_id:${random.value}}}
Eureka toolbar snapshot:

source
share