Docker - 超时值连接是超时

时间:2017-07-18 07:55:15

标签: python docker python-requests docker-compose

我刚开始使用Docker,我目前正在尝试在docker-compose.yml文件上运行docker-compose run --rm setup,但每当我这样做时,我会收到以下信息:

Traceback (most recent call last):
  File "/home/wickywills/.local/bin/docker-compose", line 11, in <module>
    sys.exit(main())
  File "/home/wickywills/.local/lib/python2.7/site-packages/compose/cli/main.py", line 68, in main
    command()
  File "/home/wickywills/.local/lib/python2.7/site-packages/compose/cli/main.py", line 118, in perform_command
    handler(command, command_options)
  File "/home/wickywills/.local/lib/python2.7/site-packages/compose/cli/main.py", line 750, in run
    run_one_off_container(container_options, self.project, service, options)
  File "/home/wickywills/.local/lib/python2.7/site-packages/compose/cli/main.py", line 1136, in run_one_off_container
    rescale=False
  File "/home/wickywills/.local/lib/python2.7/site-packages/compose/project.py", line 388, in up
    warn_for_swarm_mode(self.client)
  File "/home/wickywills/.local/lib/python2.7/site-packages/compose/project.py", line 614, in warn_for_swarm_mode
    info = client.info()
  File "/home/wickywills/.local/lib/python2.7/site-packages/docker/api/daemon.py", line 90, in info
    return self._result(self._get(self._url("/info")), True)
  File "/home/wickywills/.local/lib/python2.7/site-packages/docker/utils/decorators.py", line 46, in inner
    return f(self, *args, **kwargs)
  File "/home/wickywills/.local/lib/python2.7/site-packages/docker/api/client.py", line 189, in _get
    return self.get(url, **self._set_request_timeout(kwargs))
  File "/home/wickywills/.local/lib/python2.7/site-packages/requests/sessions.py", line 515, in get
    return self.request('GET', url, **kwargs)
  File "/home/wickywills/.local/lib/python2.7/site-packages/requests/sessions.py", line 502, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/wickywills/.local/lib/python2.7/site-packages/requests/sessions.py", line 612, in send
    r = adapter.send(request, **kwargs)
  File "/home/wickywills/.local/lib/python2.7/site-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/home/wickywills/.local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 582, in urlopen
    timeout_obj = self._get_timeout(timeout)
  File "/home/wickywills/.local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 309, in _get_timeout
    return Timeout.from_float(timeout)
  File "/home/wickywills/.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/wickywills/.local/lib/python2.7/site-packages/requests/packages/urllib3/util/timeout.py", line 97, in __init__
    self._connect = self._validate_timeout(connect, 'connect')
  File "/home/wickywills/.local/lib/python2.7/site-packages/requests/packages/urllib3/util/timeout.py", line 127, in _validate_timeout
    "int or float." % (name, value))
ValueError: Timeout value connect was Timeout(connect=60, read=60, total=None), but it must be an int or float.

Pip Freeze

backports.ssl-match-hostname==3.5.0.1
boto==2.40.0
cached-property==1.3.0
certifi==2017.4.17
chardet==3.0.4
colorama==0.3.9
cryptography==1.5
docker==2.4.2
docker-compose==1.14.0
docker-pycreds==0.2.1
dockerpty==0.4.1
docopt==0.6.2
duplicity==0.7.6
enum34==1.1.6
functools32==3.2.3.post2
idna==2.5
ipaddress==1.0.18
jsonschema==2.6.0
lockfile==0.12.2
mysql-connector-python==2.1.3
mysql-utilities==1.6.3
ndg-httpsclient==0.4.2
paramiko==2.0.0
pexpect==4.2.0
ptyprocess==0.5.1
pyasn1==0.1.9
pycrypto==2.6.1
pygobject==3.22.0
pyodbc==3.0.10
pyOpenSSL==16.1.0
pysqlite==2.7.0
python-cloudfiles==1.7.10
PyYAML==3.12
requests==2.18.1
six==1.10.0
texttable==0.8.8
urllib3==1.21.1
websocket-client==0.44.0

似乎这是一个常见问题,没有真正的解决方案。我正在运行Ubuntu 16.10,并遵循Docker文档中的安装说明。有人可以建议吗?

2 个答案:

答案 0 :(得分:8)

您的错误与this issue类似。用户关闭了问题,说它是由新版本的请求修复的,因此我会尝试在您的虚拟环境中升级requests

pip install --upgrade requests

从评论中,听起来你实际上需要卸载然后重新安装,而不仅仅是升级。

pip uninstall requests
pip install requests

答案 1 :(得分:1)

如果有人遇到与我相同的问题(错误消息相同),则先前的命令不足以纠正该问题。

在请求内安装了一个旧的无用的urllib3 ... 所以我做到了:

docker network create --subnet=172.128.28.0/24 br0

成功了!