jonashackt / cxf-spring-cloud-netflix-docker

Example project combining Spring Boot apps with Spring Cloud Netflix (Eureka, Zuul, Feign) & cxf-spring-boot-starter
https://blog.codecentric.de/en/2017/05/ansible-docker-windows-containers-scaling-spring-cloud-netflix-docker-compose/
MIT License
39 stars 20 forks source link

If I don't provide host port in microservice, it is unable to correctly register with eureka #1

Open mahima12agarwal opened 7 years ago

mahima12agarwal commented 7 years ago

Hi , In my docker-compose file if I don't provide a host port mapping for my microservice, it is unable to register in eureka correctly as it gets registered with the server.port , but the host port is assigned randomly.

this is my docker-compose file

version: '3' services: eureka: restart: always tty: true image: eureka_server:1.0 working_dir: /app volumes:

networks: lip: driver: bridge

Please help with this issue.

jonashackt commented 7 years ago

Seems that u´re using another project - not that one here (cxf-spring-cloud-netflix-docker)... So it´s not really related question ;)

But nevertheless: This registration process to Eureka is mostly done through setting the right config properties to your application.properties / application.yml file in your apps. Do you have a GitHub repo with your applications ready? You could also have a look into the projects in this repo here to get inspired. The critical props look like this:

eureka:
  client:
    serviceUrl:
      defaultZone: http://${registry.host:localhost}:${registry.port:8761}/eureka/