'I can't communicate between 2 dockers that connected to the same network
I have 2 dockers, one is the client and the other is the server.
After deployment, I can't reach the server from the client.
Here is my docker-compose file:
version: "3"
services:
# should be locate once in the control node
log_server:
build: ./logServer/
restart: unless-stopped
ports:
- "4000:80"
networks:
- logging-net
volumes:
- persistLogs:/var/log/files
- sharedError:/var/errors
# We should have 1 on EVERY node and configure it to
# collect logs from all containers in the node
client:
depends_on:
- log_server
build: ./logClient/
restart: unless-stopped
environment:
- LOG_SERVER=log_server
networks:
- logging-net
volumes:
- nodeWideLogs:/var/log/files
- sharedError:/var/errors
deploy:
mode: global
networks:
logging-net:
external: true
volumes:
sharedError:
driver: local
persistLogs:
driver: local
nodeWideLogs:
driver: local
here is how I try to communicate from the client:
python
import reuests
token = requests.get('http://log_server:4000/login', auth=('clientLog', 'Bbn4uazkVvfyHxhcbrhk2MeAE9yPh4r4nRfHWv'))
This is the error:
requests.exceptions.ConnectionError: HTTPConnectionPool(host='log_server', port=4000): Max retries exceeded with url: /login (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f0c2f470220>: Failed to establish a new connection: [Errno 111] Connection refused'))
What I do rung? They are both on the same network...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
