I'm running a Zuul service and Eureka service on separate docker containers with minimalistic configurations (both are spring boot projects).
Eureka:
docker-compose.xml:
version: '2'
services:
app:
build:
context: ./
image: eureka
environment:
eureka.client.serviceUrl.defaultZone: http://eurekaserver_app_1:8070/eureka/
tty: false
network_mode: bridge
ports:
- 8070:8070
DockerFile:
FROM java:8
COPY ./build/libs/eureka-server-0.0.1-SNAPSHOT.jar /usr/src/eureka/
WORKDIR /usr/src/eureka
EXPOSE 8070
CMD ["java","-jar","eureka-server-0.0.1-SNAPSHOT.jar"]
Zuul:
docker-compose.xml:
version: '2'
services:
app:
build:
context: ./
image: zuul-service
environment:
eureka.client.serviceUrl.defaultZone: http://eurekaserver_app_1:8070/eureka/
tty: false
ports:
- 8069:8069
network_mode: bridge
DockerFile:
FROM java:8
COPY ./build/libs/zuul-service-0.0.1-SNAPSHOT.jar /usr/src/item/
WORKDIR /usr/src/item
EXPOSE 8069
ENTRYPOINT ["java","-jar","zuul-service-0.0.1-SNAPSHOT.jar"]
I used the network ls --no-trunc
Docker command to make sure they are not spinning up a new network:
NETWORK ID NAME DRIVER SCOPE
ba216f3e01bb168848074a99875666fe382a4eda15daad0c428a8102707ee49f bridge bridge local
a63a8adf0fd162d9b99bdf77bc4a13c0bfcfb8a9aca3c5375e60d5df5c5e305d host host local
2debbe96f8a96fdd8d6da983877609e0bdb7a1df6b25537f35f1608de0739fc7 none null local
Which seems alright, The problem is that Eureka container starts up properly, however zuul-service isn't when I used docker-compose up
. It throws:
com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused (Connection refused)
app_1 | at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:187) ~[jersey-apache-client4-1.19.1.jar!/:1.19.1]
app_1 | at com.sun.jersey.api.client.filter.GZIPContentEncodingFilter.handle(GZIPContentEncodingFilter.java:123) ~[jersey-client-1.19.1.jar!/:1.19.1]
app_1 | at com.netflix.discovery.EurekaIdentityHeaderFilter.handle(EurekaIdentityHeaderFilter.java:27) ~[eureka-client-1.8.6.jar!/:1.8.6]
app_1 | at com.sun.jersey.api.client.Client.handle(Client.java:652) ~[jersey-client-1.19.1.jar!/:1.19.1]
app_1 | at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682) ~[jersey-client-1.19.1.jar!/:1.19.1]
app_1 | at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74) ~[jersey-client-1.19.1.jar!/:1.19.1]
app_1 | at com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:509) ~[jersey-client-1.19.1.jar!/:1.19.1]
app_1 | at com.netflix.discovery.shared.transport.jersey.AbstractJerseyEurekaHttpClient.getApplicationsInternal(AbstractJerseyEurekaHttpClient.java:194) ~[eureka-client-1.8.6.jar!/:1.8.6]
I am quite unsure on what I could be missing here?