Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

microservices - Docker Compose - container receiving connection refused (unable to let container communicates to each other)

I have created docker-compose that dockerizes two microservices and database. I have linked the service to the database in docker-compose successfully but unable to let application communicates service.

version: "3"
services:
  cms-degree-apps:
    image: cms-degree-applications:1.0
    build: .
    ports:
      - "8092:8092"
    depends_on:
      - cms-degree-service
  cms-degree-service:
    image: cms-degree-service:1.0
    build: .
    ports:
      - "8090:8090"
    depends_on:
      - mysql-degree-service
    environment:
      MYSQL_ROOT_PASSWORD: degreewebservice
      MYSQL_DATABASE: testing
      MYSQL_USER: ds
      MYSQL_PASSWORD: degreewebservice
    networks:
      - degree
  mysql-degree-service:
    image: mysql:5.6
    ports:
      - "3307:3306"
    environment:
      MYSQL_ROOT_PASSWORD: degreewebservice
      MYSQL_DATABASE: testing
      MYSQL_USER: ds
      MYSQL_PASSWORD: degreewebservice
    networks:
      - degree
networks:
  degree:
    driver: bridge

Here is the error:

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8090/api/alldegree": Connect to localhost:8090 [localhost/127.0.0.1] failed: Connection refused (Connection refused); nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:8090 [localhost/127.0.0.1] failed: Connection refused (Connection refused)] with root cause

question from:https://stackoverflow.com/questions/65895592/docker-compose-container-receiving-connection-refused-unable-to-let-container

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...