I ran into a
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host=’chromedriver’, port=4444): Max retries exceeded with url: /wd/hub/session (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x7fc2de559bb0>: Failed to establish a new connection: [Errno 111] Connection refused’))
While running Selenium via Python and Docker.
My Connection looks like this:
JavaScript
x
5
1
self.driver = webdriver.Remote(
2
command_executor='http://chromedriver:4444/wd/hub',
3
options=options
4
)
5
The docker-compose like this:
JavaScript
1
26
26
1
2
chromedriver:
3
image: selenium/standalone-chrome
4
ports:
5
- "4444:4444"
6
hostname: chromedriver
7
shm_size: 2g
8
runner:
9
image: "kevoooo/twitchfarm-runner:latest"
10
entrypoint: "python3 /py-scripts/main.py"
11
healthcheck:
12
test: python3 /py-scripts/main.py
13
interval: 30s
14
timeout: 10s
15
retries: 5
16
environment:
17
- DISPLAY=127.0.0.1
18
- USER=uname
19
- PASS=pass
20
- 2FA_KEY=key
21
volumes:
22
- "chrome-data:/saves/google-chrome"
23
depends_on:
24
- chromedriver
25
26
Thanks in advance!
Advertisement
Answer
I solved it by changing the entrypoint of “runner” to:
JavaScript
1
2
1
entrypoint: bash -c "sleep 10 && python3 /py-scripts/main.py"
2
I thought, that was handled by the “depends-on”-clause