[英]Docker compose com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
I tried to implement an example of Spring Boot Microservice examples.我尝试实现Spring Boot Microservice示例的示例。 I have a problem in docker-compose file.
我在docker-compose文件中有问题。
Eureka server and api gateways throws an issue defined below while there is no issue in config server. Eureka 服务器和api 网关会引发下面定义的问题,而配置服务器中没有问题。
Here is the issue: com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
这是问题:
com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
Here is the code snippets for config server .这是config server的代码片段。
configserver:
image: configserver
container_name: configServer
build:
context: ./configserver
dockerfile: Dockerfile
environment:
CONFIGSERVER_URI: "http://localhost:9191"
CONFIGSERVER_PORT: "9191"
ports:
- "9191:9191"
networks:
backend:
aliases:
- "configserver"
Here is the code snippets for eureka server这是尤里卡服务器的代码片段
eurekaserver:
image: eurekaserver
ports:
- "8761:8761"
build:
context: ./discoveryserver
dockerfile: Dockerfile
environment:
CONFIGSERVER_URI: "http://localhost:9191"
CONFIGSERVER_PORT: "9191"
EUREKASERVER_URI: "http://localhost:8761/eureka/"
EUREKASERVER_PORT: "8761"
depends_on:
configserver:
condition: service_started
networks:
backend:
aliases:
- "eurekaserver"
Here is the code snippets for api gateway server .这是api 网关服务器的代码片段。
gatewayserver:
image: gatewayserver
ports:
- "8600:8600"
build:
context: ./api-gateway
dockerfile: Dockerfile
environment:
PROFILE: "default"
SERVER_PORT: "8600"
CONFIGSERVER_URI: "http://localhost:9191"
EUREKASERVER_URI: "http://localhost:8761/eureka/"
EUREKASERVER_PORT: "8761"
CONFIGSERVER_PORT: "9191"
depends_on:
configserver:
condition: service_started
eurekaserver:
condition: service_started
networks:
backend:
aliases:
- "gateway"
Here is all docker-compose.yml: Link这是所有 docker-compose.yml: 链接
Services are no longer running on localhost.服务不再在 localhost 上运行。 So change:
所以改变:
EUREKASERVER_URI: "http://localhost:8761/eureka/"
To corresponding service container name, take Eureka server for instance:对应的服务容器名称,以 Eureka 服务器为例:
EUREKASERVER_URI: "http:///eurekaserver:8761/eureka/"
See Github issue .请参阅Github 问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.