我有一个spring cloud配置服务器并将其打包为docker镜像,然后我也有spring cloud eureka服务器也打包为docker镜像。
当我使用docker compose运行两者时,出现以下错误。
discovery-service_1 | 2017-06-24 15:36:12.059 INFO 5 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://config-service:9001
discovery-service_1 | 2017-06-24 15:36:12.997 WARN 5 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://config-service:9001/cls-discovery-service/default": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused)
尽管配置服务已启动并成功运行,但是由于某种原因,发现服务仍然找不到它。
这里使用的Docker撰写文件是这个
version: '2'
services:
config-service:
image: cloudsea/cls-config-service
ports:
- 9001:9001
expose:
- "9001"
discovery-service:
image: cloudsea/cls-discovery-service
depends_on:
- config-service
environment:
CLOUD_SEA_CONFIG_SERVER_URI: http://config-service:9001 …
spring-boot spring-cloud docker-compose spring-cloud-netflix spring-cloud-config