We are trying to deploy Netflix Eureka Server on Docker container which is a Spring Boot application. We are deploying it as a docker service with Docker swarm for container orchestration. Everything works fine when we directly create the container and run the application. Eureka server registers all the client application with correct IP addresses. But when we create and deploy it as docker service it registers the application with the wrong IP address.
We have tried below solution as per spring documentation, updated property values in our configuration files.
spring: cloud: inetutils: ignoredInterfaces: - docker0 - veth.* eureka: instance: preferIpAddress: true
Tried these solutions as well:
While we run the docker service, the container gets assigned one IP address lets say 172.16.1.3 and service started inside docker gets assigned new IP address 172.16.1.4, because of this issue client application registers its self with container's IP into Eureka server. But it is accessible with 172.16.1.4.
So why running docker as service assigns two IP addresses?