Search code examples
amazon-web-servicesdockeramazon-ecsnetflix-eurekaservice-discovery

How do I pass Eureka service ip to my java application running in a docker container?


I have number of java and python services running in docker containers in clustered environment. I'm using Eureka for service discovery and it works fine locally with Eureka ip address hardcoded in application configuration files. I have problem with flexible configuration of Eureka service for Java services - docker containers with the services will be deployed in three environments where Eureka will have different ip addresses. Is there a way to pass Eureka URI using e.g. JVM environment variable?

Or if I pass the URI as an application argument, how can I get it propagated to the Eureka client configuration?

PS: I use AWS ECS and due to number of services and existing AWS constraints I cannot put all docker containers in a single task definition, cannot use docker names resolving and just hardcode Eureka hostname, on the other hand I might have multiple Eureka instances and would like to specify which one particular container should use.


Solution

  • The answer to this my question would be to use configuration server, description of this beast can be found here https://dzone.com/articles/using-spring-config-server.