I'm a very beginner in docker world, and I'm not able to make two containers communicate using docker compose. I have two containers:
- Service Registry: a simple spring boot application using Netflix Eureka to implement a service registry feature.
- API Gateway: a simple spring boot application using Netflix Zuul. This application will try periodically to be registered into the Service Registry application by connecting to a given URL
All work fine without docker !! And now with docker-compose, the gateway is not able to find the Eureka server URL.
docker-compose.yml file:
version: '3.5'
services:
gateway:
build:
context: ../robots-store-gateway
dockerfile: Dockerfile
image: robots-store-gateway
ports:
- 8000:8000
networks:
- robots-net
serviceregistry:
build:
context: ../robots-sotre-serviceregistry
image: robots-sotre-serviceregistry
ports:
- 8761:8761
networks:
- robots-net
networks:
robots-net:
name: custom_network
driver: bridge
The application.yml file of the gateway is:
eureka:
client:
service-url:
default-zone: http://serviceregistry:8761/eureka/
I receive this exception:
com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused (Connection refused)
I tried different ways to configure the Eureka client but no way !! it doesn't work. Thanks in advance.