使用自定义IP从Docker注册到Eureka [英] Register to Eureka from Docker with a custom IP

查看:720
本文介绍了使用自定义IP从Docker注册到Eureka的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Docker VM中运行Spring Cloud Eureka。我已经向其注册了服务,但是它们从Docker VM内部使用其IP地址,但是要能够正确使用它们,我需要它们使用我可以从VM外部访问的IP地址。

I'm running Spring Cloud Eureka inside my Docker VM. I have services registering to it, but they use their IP adress from inside the Docker VM, but to be able to use them properly i need them to use the IP adress i can access from outside the VM.

例如,在我的VM中,使用172.x.x.x的寄存器,我可以使用192.168.x.x.x从浏览器访问REST接口。我需要他们将其注册为192.168.x.x.x。

For example inside my VM the register using 172.x.x.x and i can access the REST interface from my browser using 192.168.x.x.x. I need them to register as 192.168.x.x.x.

我如何告诉我的服务使用特定IP地址进行注册?

How can i tell my service to register with a specific IP adress?

推荐答案

您可以在 application.yml 中进行配置:

eureka:
    instance:
        ipAddress: 192.168.x.x

这篇关于使用自定义IP从Docker注册到Eureka的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆