I'm setting up a new container 'A' which is calling some endpoints from container 'B'. Why are these calls always return dial tcp 116.203.153.48:8082: i/o timeout
?
The call from container 'A' is using public IP. All containers are deployed on the CentOS 7. Every container has own network with own database in this network. Also, the call which returns error works fine from any REST-API client, such Postman. Nameservers in resolv.conf file has been changed to google's 8.8.8.8 and 8.8.4.4
Error: error="Post http://116.203.153.48:8082/new_user?email=eto@email.com: dial tcp 116.203.153.48:8082: i/o timeout"
Call from the program:
req, err := http.NewRequest(http.MethodPost, fmt.Sprintf("http://116.203.153.48:8082/new_user?email=%s", user.Email), nil)
if err != nil {
return err
}
httpClient := &http.Client{}
resp, err := httpClient.Do(req)
if err != nil {
return err
}
UPD:
Docker-compose of the first container:
payment-ms:
container_name: payment-ms
build:
context: .
dockerfile: Dockerfile
environment:
- DB_HOST=payment-ms-db
ports:
- 8082:8082
Docker-compose file of the second container:
user-ms:
container_name: user-ms
build:
context: .
dockerfile: Dockerfile
environment:
- DB_HOST=user-ms-db
ports:
- 8080:8080
depends_on:
user-ms-db:
condition: service_healthy
Also, on my local machine with MacOS everything works fine, problem reproducing only on VPS with CentOS7.