These are chat archives for spring-cloud/spring-cloud

5th
Feb 2018
Zhenyang Hua
@zhenyanghua
Feb 05 2018 14:04

I have config problem with Zuul and Docker:

gateway  | 2018-02-05 13:46:38.856  WARN 1 --- [nio-8080-exec-1] o.s.c.n.z.filters.post.SendErrorFilter   : Error during filtering
gateway  | 
gateway  | com.netflix.zuul.exception.ZuulException: Connect to user-management:8095 [user-management/172.19.0.3] failed: Connection refused (Connection refused)

where I set user-management as a docker hostname in the docker-compose.yml. My Zuul setting is:

zuul:
  routes:
    user-management:
     path: /um/**
     url: http://user-management:8095
ribbon:
 eureka:
   enabled: false
eureka:
 client:
   enabled: false

and Eureka is disabled.
I can successfully ping user-management:8095 from the Zuul container:

docker exec -it gateway ping user-management:8095
64 bytes from 172.19.0.3: seq=0 ttl=64 time=0.149 ms
64 bytes from 172.19.0.3: seq=1 ttl=64 time=0.115 ms
64 bytes from 172.19.0.3: seq=2 ttl=64 time=0.093 ms

Now I am out of idea why the connection is refused when the Zuul is accessing the user-management:8095.
Could you help?

Here is my docker-compose.yml:
services:
  gateway:
    image: $my_registry/gateway
    ports:
      - 8080:8080
    expose:
      - 8080
    container_name: gateway
    links:
      - user-management
  user-management:
    image: $my_registry/user-management
    ports:
      - 8095:8095
    expose:
      - 8095
    container_name: user-management
    hostname: user-management
Dave Syer
@dsyer
Feb 05 2018 14:12
AFAIK ping does not take a port in its args
So that ping command looks wrong o me
Zhenyang Hua
@zhenyanghua
Feb 05 2018 14:13
how do I test the port connection then?
Dave Syer
@dsyer
Feb 05 2018 14:14
Don't know. But if that erally was the ping command you used, then you would get an error.
So I don't know what to believe.
Zhenyang Hua
@zhenyanghua
Feb 05 2018 14:19
$ docker exec -it gateway nc -zv 172.19.0.4 8095
$ docker exec -it gateway nc -zv 127.0.0.1 8080
127.0.0.1 (127.0.0.1:8080) open
With the above command the test proves that the connection to 8095 is failed
But don’t know why, is there anything I configured wrong?
com.netflix.zuul.exception.ZuulException: Connect to user-management:8095 [user-management/172.19.0.4] failed: Connection refused (Connection refused)
Dave Syer
@dsyer
Feb 05 2018 14:23
It looks like your service is running on the wrong port?
Zhenyang Hua
@zhenyanghua
Feb 05 2018 14:23
it should be 8095 for user-management, and 8080 for the gateway
Dave Syer
@dsyer
Feb 05 2018 14:24
You haven't shown the configuration of the user-management app. We don't know what port it is running on.
Zhenyang Hua
@zhenyanghua
Feb 05 2018 14:25
Where 172.19.0.4:8095 is the user-management
It is configured via httpd
Listen 8095
The user-managment is just a static served website
When the gateway is run in the host server, it works with the containerized user-management, but when it was run in the container, it refuses the connection
Dave Syer
@dsyer
Feb 05 2018 14:29
It's a docker networking question then. Not really a Spring Cloud question.
Zhenyang Hua
@zhenyanghua
Feb 05 2018 14:30
So for the Zuul config part, you don’t see any problem with the config I have there?
Dave Syer
@dsyer
Feb 05 2018 14:30
No (which isn't to say there are none).
Zhenyang Hua
@zhenyanghua
Feb 05 2018 14:30
understood, thanks!