i have created simple spring cloud app with eureka server and client registering to eureka service. i've below in bootstrap.yml for eureka client.
eureka:
client:
registerWithEureka: true
fetchRegistry: true
serviceUrl:
defaultZone: ${eureka.url:http://localhost:8761/eureka/,http://localhsot:8762/eureka/}
instance:
preferIpAddress: true
ipAddress: 192.168.1.148
when running as direct spring boot apps, it works fine and registers client using IP address to eureka server. But when i run client as docker container, it always uses docker container id to register in eureka server.
I am using docker for mac version 1.13.1. and spring boot version 1.4.1. I looked at issue #1646 but it seems that issue was resolved and it was not with docker for mac. so, not sure.
Any help is appreciated. Thank you
It is really hard to tell if your YAML is correct because of the way it is formatted, can you fix that?
sorry about that.. putting yml below again :
eureka:
client:
registerWithEureka: true
fetchRegistry: true
serviceUrl:
defaultZone: ${eureka.url:http://localhost:8761/eureka/,http://localhsot:8762/eureka/}
instance:
preferIpAddress: true
ipAddress: 192.168.1.148
@niral22 there's nothing there sticking out. What version of spring-cloud-netflix are you using? What does /env say on docker. How do you know "it always uses docker container id to register in eureka server"? What does /eureka/apps say?
@spencergibb - Thanks spencer for your pointers. I got it working. Basically, in eureka server, it gives docker container id. but actual link for the client is with host ip address. which I found by looking /eureka/apps url. thank you again.
Most helpful comment
sorry about that.. putting yml below again :