admin管理员组文章数量:1287116
I'm deploying a Spring Boot microservice using Docker Compose, but it's still trying to fetch its configuration from http://localhost:8888 instead of the config-service container.
Spring Boot Configuration (application.yml):
spring:
application:
name: ${APP_NAME:iam-service}
cloud:
config:
uri: ${CONFIG_SERVER_URI:http://localhost:8888}
name: iam-service,security-conf,eureka-properties
profile: ${PROFILE:dev}
config:
import: "configserver:"
# Server Configuration
server:
servlet:
context-path: ${CONTEXT_PATH:/api/v1/iam}
port: ${IAM_SERVER_PORT:8881}
Docker Compose Configuration (docker-compose.yml):
version: "3.8"
services:
iam-service:
container_name: iam-service
image: ${DC_IMAGE_NAME}:${DC_IMAGE_TAG}
ports:
- 8881:8881
environment:
- CONFIG_SERVER_URI=http://config-service:8888
- IAM_SERVER_PORT=8881
networks:
- ms-network
restart: always
networks:
ms-network:
external:
name: ms_network
Issue: Despite setting CONFIG_SERVER_URI=http://config-service:8888 in Docker Compose, the logs show:
Fetching config from server at : http://localhost:8888
It seems that Spring Boot is not picking up the environment variable. I've verified that the container is running on the correct network and that config-service is reachable.
本文标签: Spring Boot Microservice Not Using CONFIGSERVERURI from Docker ComposeStack Overflow
版权声明:本文标题:Spring Boot Microservice Not Using CONFIG_SERVER_URI from Docker Compose - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741267022a2368668.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论