spring-cloud / spring-cloud/spring-cloud-config

org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8888/user-microservice/default": Connection refused

Open
#2,768 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

waiting-for-triage
Dominant language
Java
Stars
2k
Forks
1.3k
Avg merge
2d 59m
Merged PRs (30d)
16

Description

My user-service config client failed to load configuration from config-service. Initially, I thought the issue was with the config-service, but when I tested it using curl http://localhost:8888/user-microservice/default, it successfully returned data. The problem only occurs when using Docker Compose, whereas everything works fine when running directly in the IDE. Could you provide some insights to help resolve this?

Also, the configurations for both user-service and book-service are stored in a remote repository accessible from config-service server.

That's docker-compose.file:

version: "3.9"
services:
  config-service:
    build: ./ConfigServer
    container_name: config-service
    ports:
      - "8888:8888"
    environment:
      - GIT_USERNAME=${GIT_USERNAME}
      - GIT_PASSWORD=${GIT_PASSWORD}
    networks:
      - library-network

  discovery-service:
    build: ./EurekaServer
    container_name: discovery-service
    ports:
      - "8761:8761"
    depends_on:
      - config-service
    networks:
      - library-network

  gateway-service:
    build: ./API_Gateway
    container_name: gateway-service
    ports:
      - "8090:8090"
    depends_on:
      - discovery-service
    networks:
      - library-network

  user-service:
    build: ./user-microservice
    container_name: user-service
    ports:
      - "8081:8081"
    depends_on:
      - discovery-service
      - config-service
    networks:
      - library-network

  book-service:
    build: ./book-microservice
    container_name: book-service
    ports:
      - "8082:8082"
    depends_on:
      - discovery-service
    networks:
      - library-network

networks:
  library-network:
    driver: bridge

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the docker-compose configuration shown in the issue, especially the config-service and user-service entries, and compare how the configuration client reaches the server in Docker versus the IDE. Reproduce the failure with Docker Compose and verify that user-service loads its remote configuration without a connection-refused error.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker-compose, git, java, spring-boot
Domain
backend, cloud, devops, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.