我的 docker-compose 有问题。我正在尝试使用一个 spring-cloud-config-server 创建多个容器,并尝试将 spring-cloud 服务器与我的 webapps 容器一起使用。
这是我的容器列表:
- 1 用于 BDD (db)
- 1 用于 spring 云配置服务器(configproperties)
- 1 对于一些 webapps (webapps)
- 1 用于反向代理的 nginx (cnginx)
我已经尝试使用 localhost,我的配置服务器名称作为环境变量中的主机:SPRING_CLOUD_CONFIG_URI 和 boostrap.properties。我的 'configproperties' 容器,在 server.xml 中使用 8085。
那是我的 docker-compose.yml
version: '3'
services:
cnginx:
image: cnginx
ports:
- 80:80
restart: always
depends_on:
- configproperties
- cprocess
- webapps
db:
image: postgres:9.3
environment:
POSTGRES_USER: xxx
POSTGRES_PASSWORD: xxx
restart: always
command:
- -c
- max_prepared_transactions=100
configproperties:
restart: on-failure:2
image: configproperties
depends_on:
- db
expose:
- "8085"
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/mydbName?currentSchema=public
webapps:
restart: on-failure:2
image: webapps
links:
- "configproperties"
environment:
- SPRING_CLOUD_CONFIG_URI=http://configproperties:8085/config-server
- SPRING_PROFILES_ACTIVE=docker
depends_on:
- configproperties
expose:
- "8085"
当我运行我的 docker-compose 时,我的 webapps 正在部署一些错误,例如:
- 无法解析值“$ {repository.temps}”中的占位符'repository.temps'
但是当我使用邮递员并发送这样的请求时:
http://localhost/config-server/myApplication/docker/latest
它工作正常,请求返回“myApplication”的所有配置。
我想我想念一些东西,但我没有找到它......
任何人都可以帮助我吗?
问候,