docker / docker-py

A Python library for the Docker Engine API
https://docker-py.readthedocs.io/
Apache License 2.0
6.82k stars 1.67k forks source link

(requests.packages.urllib3.connectionpool) Connection pool is full, discarding connection: localhost #1636

Open MatthiasLohr opened 7 years ago

MatthiasLohr commented 7 years ago

Hello,

i've a problem with version 2.3.0 when trying to get my script running. It fails on calling docker_client.containers.get(container_name):

2017-06-09 11:07:29,404 WARNING (requests.packages.urllib3.connectionpool) Connection pool is full, discarding connection: localhost
Traceback (most recent call last):
  File "./f5fpc-client.py", line 134, in <module>
    sys.exit(main())
  File "./f5fpc-client.py", line 43, in main
    container = docker_client.containers.get(container_name)
  File "/home/mlohr/.local/lib/python2.7/site-packages/docker/models/containers.py", line 757, in get
    resp = self.client.api.inspect_container(container_id)
  File "/home/mlohr/.local/lib/python2.7/site-packages/docker/utils/decorators.py", line 21, in wrapped
    return f(self, resource_id, *args, **kwargs)
  File "/home/mlohr/.local/lib/python2.7/site-packages/docker/api/container.py", line 750, in inspect_container
    self._get(self._url("/containers/{0}/json", container)), True
  File "/home/mlohr/.local/lib/python2.7/site-packages/docker/utils/decorators.py", line 47, in inner
    return f(self, *args, **kwargs)
  File "/home/mlohr/.local/lib/python2.7/site-packages/docker/api/client.py", line 183, in _get
    return self.get(url, **self._set_request_timeout(kwargs))
  File "/home/mlohr/.local/lib/python2.7/site-packages/requests/sessions.py", line 526, in get
    return self.request('GET', url, **kwargs)
  File "/home/mlohr/.local/lib/python2.7/site-packages/requests/sessions.py", line 513, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/mlohr/.local/lib/python2.7/site-packages/requests/sessions.py", line 623, in send
    r = adapter.send(request, **kwargs)
  File "/home/mlohr/.local/lib/python2.7/site-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/home/mlohr/.local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 587, in urlopen
    timeout_obj = self._get_timeout(timeout)
  File "/home/mlohr/.local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 302, in _get_timeout
    return Timeout.from_float(timeout)
  File "/home/mlohr/.local/lib/python2.7/site-packages/requests/packages/urllib3/util/timeout.py", line 154, in from_float
    return Timeout(read=timeout, connect=timeout)
  File "/home/mlohr/.local/lib/python2.7/site-packages/requests/packages/urllib3/util/timeout.py", line 94, in __init__
    self._connect = self._validate_timeout(connect, 'connect')
  File "/home/mlohr/.local/lib/python2.7/site-packages/requests/packages/urllib3/util/timeout.py", line 127, in _validate_timeout
    "int, float or None." % (name, value))

Requests version is 2.17.3.

guedressel commented 7 years ago

I ran into the same error. Tough I'm using an older version of docker-py (1.8.1) it reads like the handling of the repositories is limited. Since we activated Googles gcr.io repositories the list in \~/.docker/config.json was quite long (>10) what lead to this issue.

Never mind my comment. It turned out that I had some bad mixtures of package dependencies on my system. After creating a fresh pipenv and reinstalling docker-py everything is up and running again...

BBerastegui commented 5 years ago

Just in case someone ends here like I ended:

pip install requests==2.11.1