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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…