Good evening, this is Kazumi Ohira, also known as @dz_.
After updating vagrant's ʻubuntu / trusty64`, docker-compose used in vagrant stopped working, so I fixed it. It is the memorandum.
When I tried to use docker-compose, I got the following python error.
vagrant@vagrant-ubuntu-trusty-64:~$ docker-compose --help
... <Abbreviation> ...
File "/usr/local/lib/python2.7/dist-packages/docker/transport/ssladapter.py", line 22, in <module>
urllib3.connection.match_hostname = match_hostname
AttributeError: 'module' object has no attribute 'connection'
'ubuntu/trusty64' (v20170131.0.0) (Ubuntu 14.04.5 LTS)#Check docker related version of python
vagrant@vagrant-ubuntu-trusty-64:~$ pip freeze | grep docker
docker==2.0.2
docker-compose==1.10.1
docker-pycreds==0.2.1
dockerpty==0.4.1
#Check Docker version
vagrant@vagrant-ubuntu-trusty-64:~$ docker version
Client:
Version: 1.13.0
API version: 1.25
Go version: go1.7.3
Git commit: 49bf474
Built: Tue Jan 17 09:50:17 2017
OS/Arch: linux/amd64
Server:
Version: 1.13.0
API version: 1.25 (minimum version 1.12)
Go version: go1.7.3
Git commit: 49bf474
Built: Tue Jan 17 09:50:17 2017
OS/Arch: linux/amd64
Experimental: false
Looking at this article, it seems that the version of python ʻurllib3 doesn't match. The latest version of ʻurllib3 is 1.20, but for some reason 1.7.1 was included.
Upon further investigation, as pointed out in this issue, python-urllib3 installed by ʻapt-get was 1.7.1`.
#Check the urllib3 version of python
vagrant@vagrant-ubuntu-trusty-64:~$ pip freeze | grep urllib3
urllib3==1.7.1
# apt-python installed with get-Check the version of urllib3
vagrant@vagrant-ubuntu-trusty-64:~$ dpkg --list | grep urllib3
ii python-urllib3 1.7.1-1ubuntu4 all HTTP library with thread-safe connection pooling for Python
ii python-urllib3-whl 1.7.1-1ubuntu4 all HTTP library with thread-safe connection pooling
But ...
Simply installing with pip install urllib3 = 1.20 did not work because docker looked towards 1.7.1. So, if you remove it with ʻapt-get remove python-urllib3 python-urllib3-whl, docker will work, but this time pipwill be uninstalled together ..., this is no good (´ ・ ω) ・)
I wanted to use docker-compose inside vagrant at this time. There are two likely ways to achieve this.
One would be to remove python-urllib3 * from ʻapt-getand installpip with get-pip.py instead of ʻapt-get.
And the other was to upgrade the version of Ubuntu.
The reason is that python-urllib3 installed by ʻubuntu / trusty (14.04)seems to be1.7.1-1build1, but python-urllib3 installed by ʻubuntu / xenial (16.04) It seems thatis 1.13.1-2.
So I got things done by updating Ubuntu to 16.04! !!
(Even in Ubuntu 16.04, ʻurllib3` is not the latest version, but there was no problem using docker-compose.)
It may be an error with a limited environment, but I hope it helps someone m (_ _) m
Recommended Posts