Docker containerized application not able to connect

I am using a spring cloud config server to externalize the configuration properties for my project
For this purpose I have created two microservices

  1. configserver
  2. accounts

when I am trying to create and start the containers using the docker compose up file, I am getting below exception
024-06-14 08:59:34 2024-06-14T03:29:34.350Z WARN 1 — [cards] [ main] o.s.c.c.c.ConfigServerConfigDataLoader : Could not locate PropertySource ([ConfigServerConfigDataResource@473b3b7a uris = array[‘http://localhost:8071/’], optional = true, profiles = ‘default’]): I/O error on GET request for “http://localhost:8071/accounts/default”: Connection refused.

Please note the configserver and rabbitmq both are getting started but account,loans and cards are getting exited due to the same error.

Also If I use the configserver as a container and start the loans,cards or accounts ms directly from IDE i am able to connect.

application.yaml for configserver
spring:
application:
name: configserver
profiles:
#active: native
active: git
cloud:
config:
server:
#native:
#search-locations: “classpath:/config”
#search-locations: “file:///D:/code/elearn_eazybank/section6/config-filepath”
git:
uri: “actual URL removed due to confidentaility”
default-label: main
timeout: 5
clone-on-start: true
force-pull: true

management:
endpoints:
web:
exposure:
include: “*”
health:
readiness-state:
enabled: true
liveness-state:
enabled: true
endpoint:
health:
probes:
enabled: true

encypt:
key: “45D81EC1EF61DF9AD8D3E5BB397F9”

server:
port: 8071

application.yaml for accounts
server:
port: 8080
logging:
level:
org:
springframework:
web: “DEBUG”
spring:
application:
name: “accounts”
profiles:
active: “prod”
datasource:
url: jdbc:h2:mem:testdb
driverClassName: org.h2.Driver
username: sa
password: ”
h2:
console:
enabled: true
jpa:
database-platform: org.hibernate.dialect.H2Dialect
hibernate:
ddl-auto: update
show-sql: true
config:
import: “configserver:http://localhost:8071/”

rabbitmq:
host: localhost
port: 5672
username: guest
password: guest

management:
endpoints:
web:
exposure:
include: “*”

**docker-compose.yaml **
services:
rabbit:
image: rabbitmq:3.13-management
hostname: rabbitmq
ports:
– “5672:5672”
– “15672:15672”
healthcheck:
test: rabbitmq-diagnostics check_port_connectivity
interval: 10s
timeout: 5s
retries: 10
start_period: 5s
extends:
file: common-config.yaml
service: network-deploy-service

configserver:
image: “dockerhub image name”
container_name: configserver-ms
ports:
– “8071:8071”
depends_on:
rabbit:
condition: service_healthy
healthcheck:
test: “curl –fail –silent localhost:8071/actuator/health/readiness | grep UP || exit 1”
interval: 10s
timeout: 5s
retries: 10
start_period: 10s
extends:
file: common-config.yaml
service: microservice-base-config

accounts:
image: “dockerhub image name”
container_name: accounts-ms
ports:
– “8080:8080”
depends_on:
configserver:
condition: service_healthy
environment:
SPRING_APPLICATION_NAME: “accounts”
extends:
file: common-config.yaml
service: microservice-configserver-config

loans:
image: “dockerhub image name”
container_name: loans-ms
ports:
– “8090:8090”
depends_on:
configserver:
condition: service_healthy
environment:
SPRING_APPLICATION_NAME: “loans”
extends:
file: common-config.yaml
service: microservice-configserver-config

cards:
image: “dockerhub image name”
container_name: cards-ms
ports:
– “9000:9000”
depends_on:
configserver:
condition: service_healthy
environment:
SPRING_APPLICATION_NAME: “cards”
extends:
file: common-config.yaml
service: microservice-configserver-config

networks:
eazybank:
driver: “bridge”

common-config.yaml

services:
network-deploy-service:
networks:
– eazybank

microservice-base-config:
extends:
service: network-deploy-service
deploy:
resources:
limits:
memory: 700m
environment:
SPRING_RABBITMQ_HOST: “rabbit”

microservice-configserver-config:
extends:
service: microservice-base-config
environment:
SPRING_PROFILES_ACTIVE: default
SPRING_CONFIG_IMPORT: configserver:http://configserver:8071/

Tried to modify the networks attribute, but nothing worked

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật