记一次安装kolla遇到DockerException: Error while fetching server API version: Timeout value connect was Timeout的问题

时间:2022-01-14 08:46:59

1)环境信息:

docker版本:17.09,当docker的版本是12.06时,也会报这个错误

[root@localhost ~]# docker --version
Docker version 17.09.1-ce, build 19e2cf6
[root@localhost ~]#

kolla版本:ocata版本

[root@localhost kolla]# git branch -a
* stable/ocata
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/stable/ocata
remotes/origin/stable/pike
remotes/origin/stable/queens
remotes/origin/stable/rocky
[root@localhost kolla]#

2)问题现象

在执行kolla-build -b centos keystone命令时,提示如下错误

[root@localhost kolla]# kolla-build -b centos keystone
INFO:kolla.image.build:Found the docker image folder at /usr/share/kolla/docker
INFO:kolla.image.build:Added image base to queue
INFO:kolla.image.build:Attempting to run task BuildTask(base) for the first time
INFO:kolla.image.build.base:Building
ERROR:kolla.image.build.base:Unknown docker error when building
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/kolla/image/build.py", line 416, in builder
for response in self.dc.build(path=image.path,
File "/usr/lib/python2.7/site-packages/kolla/image/build.py", line 132, in dc
self._dc = docker.Client(version='auto', **docker_kwargs)
File "/usr/lib/python2.7/site-packages/docker/client.py", line 99, in __init__
self._version = self._retrieve_server_version()
File "/usr/lib/python2.7/site-packages/docker/client.py", line 124, in _retrieve_server_version
'Error while fetching server API version: {0}'.format(e)
DockerException: Error while fetching server API version: Timeout value connect was Timeout(connect=60, read=60, total=None), but it must be an int, float or None.

3)原因分析

由于requests==2.18.0 bug的问题,导致执行命令的时候,一直报错,把requests升到2.18.1版本就好了

[root@localhost ~]# pip list |grep request
requests 2.18.0
requestsexceptions 1.4.0
[root@localhost ~]# pip install requests==2.18.1
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting requests==2.18.1
Downloading https://mirrors.aliyun.com/pypi/packages/5a/58/671011e3ff4a06e2969322267d78dcfda1bf4d1576551df1cce93cd7239d/requests-2.18.1-py2.py3-none-any.whl (88kB)
100% |████████████████████████████████| 92kB 4.1MB/s
Requirement already satisfied: idna<2.6,>=2.5 in /usr/lib/python2.7/site-packages (from requests==2.18.1) (2.5)
Requirement already satisfied: urllib3<1.22,>=1.21.1 in /usr/lib/python2.7/site-packages (from requests==2.18.1) (1.21.1)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/lib/python2.7/site-packages (from requests==2.18.1) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python2.7/site-packages (from requests==2.18.1) (2018.8.24)
Installing collected packages: requests
Found existing installation: requests 2.18.0
Uninstalling requests-2.18.0:
Successfully uninstalled requests-2.18.0
Successfully installed requests-2.18.1
[root@localhost ~]# pip list |grep request
requests 2.18.1
requestsexceptions 1.4.0

4)部署环境的pip列表清单

以后部署kolla ocata 版本的时候,遇到pip的版本问题,可以参考这个清单

[root@localhost kolla]# pip list
Package Version
-------------------------------- -----------
alabaster 0.7.12
ansible 2.6.3
appdirs 1.4.3
asn1crypto 0.24.0
Babel 2.6.0
backports.ssl-match-hostname 3.5.0.1
bandit 1.5.0
bashate 0.6.0
beautifulsoup4 4.6.3
certifi 2018.8.24
cffi 1.11.5
chardet 3.0.4
cliff 2.13.0
cmd2 0.8.9
configobj 4.7.2
contextlib2 0.5.5
coverage 4.5.1
cryptography 2.3.1
cssselect 1.0.3
ddt 1.2.0
debtcollector 1.20.0
decorator 4.3.0
deprecation 2.0.6
doc8 0.8.0
docker-py 1.10.6
docker-pycreds 0.3.0
docutils 0.14
dogpile.cache 0.6.7
dulwich 0.19.6
enum34 1.1.6
extras 1.0.0
fixtures 3.0.0
flake8 2.5.5
funcsigs 1.0.2
functools32 3.2.3.post2
future 0.16.0
futures 3.2.0
gitdb 0.6.4
gitdb2 2.0.4
GitPython 2.1.11
graphviz 0.9
hacking 1.0.0
httplib2 0.9.2
idna 2.5
iniparse 0.4
ipaddress 1.0.17
IPy 0.75
iso8601 0.1.12
Jinja2 2.10
jmespath 0.9.0
jsonpatch 1.23
jsonpointer 2.0
jsonschema 2.6.0
keystoneauth1 3.10.0
kolla 4.0.6.dev3
linecache2 1.0.0
lxml 4.2.5
MarkupSafe 1.0
mccabe 0.2.1
mock 2.0.0
monotonic 1.5
mox3 0.26.0
msgpack 0.5.6
munch 2.3.2
netaddr 0.7.19
netifaces 0.10.7
openstacksdk 0.17.2
os-client-config 1.31.2
os-service-types 1.3.0
osc-lib 1.11.1
oslo.config 6.4.0
oslo.context 2.21.0
oslo.i18n 3.21.0
oslo.log 3.39.0
oslo.serialization 2.27.0
oslo.utils 3.37.0
oslosphinx 4.18.0
oslotest 3.6.0
packaging 17.1
paramiko 2.1.1
pbr 4.2.0
pep8 1.5.7
perf 0.1
pip 18.1
pluggy 0.7.1
ply 3.4
policycoreutils-default-encoding 0.1
prettytable 0.7.2
py 1.6.0
pyasn1 0.1.9
pycparser 2.18
pycrypto 2.6.1
pycurl 7.19.0
pyflakes 0.8.1
Pygments 2.2.0
pygobject 3.14.0
pygpgme 0.3
pyinotify 0.9.6
pyliblzma 0.5.3
pyOpenSSL 18.0.0
pyparsing 2.2.0
pyperclip 1.6.4
python-barbicanclient 4.7.0
python-ceilometerclient 2.9.0
python-cinderclient 4.0.1
python-dateutil 2.7.3
python-glanceclient 2.12.1
python-heatclient 1.16.1
python-keyczar 0.71rc0
python-keystoneclient 3.17.0
python-mimeparse 1.6.0
python-neutronclient 6.9.0
python-novaclient 11.0.0
python-openstackclient 3.16.0
python-subunit 1.3.0
python-swiftclient 3.6.0
pytz 2018.5
pyudev 0.15
pyxattr 0.5.1
PyYAML 3.13
reno 2.9.2
requests 2.18.1
requestsexceptions 1.4.0
restructuredtext-lint 1.1.3
rfc3986 1.1.0
seobject 0.1
sepolicy 1.1
setuptools 40.2.0
simplejson 3.16.0
six 1.11.0
slip 0.4.0
slip.dbus 0.4.0
smmap 0.9.0
smmap2 2.0.4
snowballstemmer 1.2.1
Sphinx 1.3.6
sphinx-rtd-theme 0.4.2
stestr 2.1.1
stevedore 1.29.0
subprocess32 3.5.2
testrepository 0.0.20
testscenarios 0.5.0
testtools 2.3.0
tox 3.2.1
traceback2 1.4.0
unicodecsv 0.14.1
unittest2 1.1.0
urlgrabber 3.10
urllib3 1.21.1
virtualenv 16.0.0
voluptuous 0.11.5
warlock 1.3.0
wcwidth 0.1.7
websocket-client 0.51.0
wrapt 1.10.11
yum-metadata-parser 1.1.4
[root@localhost kolla]#