Describe the bug I have config server application and one service too that is wrapped in a docker container. However, when trying to connect to config server application, I can't connect. I already change the host name into the docker container, change it into the IP address/Gateway from the config server container, however it's still can't connect.
(But, if I access it through host by calling localhost:8000/orangtua-service/default
, it shows the result)
Sample
docker-compose
version: '3.7'
services:
...
config-server:
container_name: config-server
build: ./config-server
restart: on-failure
ports:
- "8000:8000"
expose:
- 8000
networks:
- sipas_network
parent-service:
container_name: parent-service
build: ./parent-service
restart: on-failure
depends_on:
- config-server
environment:
- config-server.host=config-server
ports:
- "8002:8002"
expose:
- 8002
networks:
- sipas_network
volumes:
mysql_volume:
name: mysql_volume
networks:
sipas_network:
bootstrap.yaml on parent-service
# =============================== SPRING CFG ===========================================
spring:
application:
name: orangtua-service
config:
import: configserver:http://${config-server.host}:8000/
main:
web-application-type: reactive
# =============================== SERVER CFG ===========================================
server:
port: 8002
Do I miss something? Since it works on localhost but not work on docker? Thank you
Comment From: VinncentWong
closed, the problem is with the dependency management, now I can fetch the config server, thank you
Comment From: masoud2vg
can you explain more on the dependency management? I have the same issue @VinncentWong
Comment From: silsgah
Not so fair when people get issues fixed and never share how they went about it, but yet are quick to post issues when they have one. How do you help the community grow this way.
Comment From: AbdelaliKAMIL
For the guys who still have this problem, it is sometimes because you have the same dependency in two projects or more with different versions. So better check all your dependencies in all the projects that you would run in Docker.