我有一个在docker内部运行的Spring Cloud Eureka客户端实例,我希望客户端将自己的主机IP地址而不是容器的主机名注册到Eureka服务器,所以我将eureka.instance.ip-address: xx.xx.xx.xx和eureka.instance.prefer-ip-address: true设置为客户端的application.yml,但这不起作用,它仍然将容器的主机名注册到服务器,任何帮助都是非常感谢的!
spring:
application:
name: uaa-service
server:
port: 8799
eureka:
service-url:
defaultZone: https://XX.YY.ZZ/eureka/
instance:
prefer-ip-address: true
ip-address: xx.xx.xx.xx

我的Spring Boot版本是2.0.0.RELEASE,Spring Cloud是Finchley.M9。
发布于 2018-04-25 20:13:29
我使用的是相同版本的spring-boot,也有类似的问题
但是我觉得你把IP地址和实例ID搞混了。
请参阅此链接:https://github.com/spring-cloud/spring-cloud-netflix/issues/1646#issuecomment-275121055
当您将鼠标悬停在链接上或单击它时,它是否显示正确的IP地址?
不管怎样,我有两个应用程序,一个使用spring-boot1.5,其中这个属性可以工作。
在2.0版本中,应用程序始终使用机器IP,而不是我在eureka.instance.ip-address中通知的IP。
编辑>我在这里报告了一个错误:https://github.com/spring-cloud/spring-cloud-netflix/issues/2878
发布于 2018-04-06 13:49:30
把这个放在你的春季服务中
spring:
application:
name: uaa-service
cloud:
inetutils:
ignored-interfaces:
- eth0
- eth1
- eth2
- eth3
- lo摘自this
https://stackoverflow.com/questions/49684566
复制相似问题