I took this example https://github.com/paulc4/microservices-demo and I created 3 docker images from it, with the following Dockerfiles:
springdocker-registration:
<
For those who are working with docker-compose and if in your services yml file you have the following:
eureka:
client:
serviceUrl:
# Will get overridden in docker-compose
defaultZone: http://localhost:1111/eureka
You can override this in your docker-compose file like below while running docker-compose up
version: "3.3"
services:
# Other services registered above
web:
image: springdocker-web
environment:
# Important for clients to register with eureka
- eureka.client.serviceUrl.defaultZone=http://registration:8761/eureka/
ports:
- "3333:3333"
depends_on:
- registration
- accounts
links:
- registration
Tested on Docker version 19.03.8