Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mahima12agarwal opened this issue Jun 28, 2017 · 1 comment
Labels

Comments

@mahima12agarwal
Copy link

mahima12agarwal commented Jun 28, 2017

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:
- ./eureka_server:/app
ports:
- 8761:8761
networks:
- lip

products:
restart: always
image: product-service-ms:1.0
tty: true
working_dir: /app
volumes:
- ./product-service:/app
ports:
- 8082
environment:
EUREKA_URI: "${EUREKA_URI}"
EUREKA_IP: "${EUREKA_IP}"
HOSTNAME: "${HOSTNAME}"
networks:
- lip

zuul-server:
restart: always
image: zuul-proxy-server:1.0
tty: true
working_dir: /app
volumes:
- ./zull-server:/app
ports:
- 80:80
environment:
EUREKA_URI: "${EUREKA_URI}"
EUREKA_IP: "${EUREKA_IP}"
HOSTNAME: "${HOSTNAME}"
networks:
- lip

zipkin:
restart: always
image: zipkin-server:1.0
tty: true
working_dir: /app
volumes:
- ./zipkin-server:/app
ports:
- 8096:8096
environment:
EUREKA_URI: "${EUREKA_URI}"
EUREKA_IP: "${EUREKA_IP}"
HOSTNAME: "${HOSTNAME}"
networks:
- lip

adminconsole:
restart: always
image: spring-admin-console:1.0
tty: true
working_dir: /app
volumes:
- ./zipkin-server:/app
ports:
- 8181:8181
environment:
EUREKA_URI: "${EUREKA_URI}"
EUREKA_IP: "${EUREKA_IP}"
HOSTNAME: "${HOSTNAME}"
networks:
- lip

networks:
lip:
driver: bridge

Please help with this issue.

@jonashackt
Copy link
Owner

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants