docker.errors.DockerException: Error while fetching server API version: HTTPConnection.request() got

Source

ubuntu 22.0.4运行docker-compose报错docker.errors.DockerException: Error while fetching server API version: HTTPConnection.request() got an unexpected keyword argument 'chunked

需要安装`pip install ‘urllib3<2’:

  • 安装pip(如果没有)
apt-get install pip -y
  • 忽略error: externally-managed-environment错误
sudo mv $(find /usr/lib/ -type d -name "*python*" |tail -1)/EXTERNALLY-MANAGED $(find /usr/lib/ -type d -name "*python*" |tail -1)/EXTERNALLY-MANAGED.bk
  • 解决报错ERROR: Cannot uninstall urllib3 2.0.7, RECORD file not found. Hint: The package was installed by debian.
# 如果出现The package was installed by debian这种提示,只需要用python安装一次就不会报错了
sudo pip install --ignore-installed urllib3
sudo pip install --ignore-installed idna
  • 解决依赖问题:
sudo pip install --ignore-reinstall 'requests<2.29.0' 'urllib3<2.0'

enjoy it !!!