(Sorry for the rushed bug report, just heading out the door... will fix later if there's missing details)
Ubuntu 14.04 (on vagrant)
Installing docker on the system, which brings in docker-compose 1.10.1 package
Try to do "docker-compose build", fails:
$ docker-compose build
Traceback (most recent call last):
File "/usr/local/bin/docker-compose", line 7, in <module>
from compose.cli.main import main
File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 41, in <module>
from . import errors
File "/usr/local/lib/python2.7/dist-packages/compose/cli/errors.py", line 10, in <module>
from docker.errors import APIError
File "/usr/local/lib/python2.7/dist-packages/docker/__init__.py", line 2, in <module>
from .api import APIClient
File "/usr/local/lib/python2.7/dist-packages/docker/api/__init__.py", line 2, in <module>
from .client import APIClient
File "/usr/local/lib/python2.7/dist-packages/docker/api/client.py", line 11, in <module>
from .build import BuildApiMixin
File "/usr/local/lib/python2.7/dist-packages/docker/api/build.py", line 9, in <module>
from .. import utils
File "/usr/local/lib/python2.7/dist-packages/docker/utils/__init__.py", line 2, in <module>
from .utils import (
File "/usr/local/lib/python2.7/dist-packages/docker/utils/utils.py", line 19, in <module>
from .. import tls
File "/usr/local/lib/python2.7/dist-packages/docker/tls.py", line 5, in <module>
from .transport import SSLAdapter
File "/usr/local/lib/python2.7/dist-packages/docker/transport/__init__.py", line 3, in <module>
from .ssladapter import SSLAdapter
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'
This is a known issue (https://github.com/docker/docker-py/issues/1054), but was working fine with docker-compose 1.10.0.
But this change in docker-compose 1.10.1 is causing the above error:
https://github.com/docker/compose/commit/5895d8bbc9939524b449e296ac93d8e98aa70eb0#diff-228ac110a2a9f4c594407b860e1b0ed0
Specifically:
pip = __import__('pip')
This line alters the sys.path. Before that line:
sys.path: ['/usr/local/bin', '/test', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']
After that line:
sys.path: ['/usr/share/python-wheels/setuptools-3.3-py2.py3-none-any.whl', '/usr/share/python-wheels/urllib3-1.7.1-py2.py3-none-any.whl', '/usr/share/python-wheels/html5lib-0.999-py2.py3-none-any.whl', '/usr/share/python-wheels/pip-1.5.4-py2.py3-none-any.whl', '/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl', '/usr/share/python-wheels/distlib-0.1.8-py2.py3-none-any.whl', '/usr/share/python-wheels/chardet-2.2.1-py2.py3-none-any.whl', '/usr/share/python-wheels/six-1.5.2-py2.py3-none-any.whl', '/usr/share/python-wheels/colorama-0.2.5-py2.py3-none-any.whl', '/usr/local/bin', '/test', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']
Notably, the "/usr/share/python-wheels/urllib3-1.7.1-py2.py3-none-any.whl" package is added to the top of the path, making it impossible to override with PYTHONPATH or anything else later. This means request will be forced to use the older ubuntu 14.04's urllib 1.7, which breaks everything.
Downgrading to docker-compose 1.10.0 fixes this, allowing the code to use a newer urllib3 version than what's installed in the system.
Thank you for the report!
Ubuntu can really be a pain sometimes. As a workaround until I figure this stuff out, the binary should work fine since it uses frozen, packaged dependencies: https://github.com/docker/compose/releases/tag/1.10.1
Other alternative: do not use the version of pip bundled by Ubuntu as it messes with dependencies
Instead, install pip
using the get-pip.py script
If you are encountering this issue, please try out the potential fix in #4484 . You can use the following command:
pip install -e 'git+https://github.com/shin-/compose.git@66f4a795a2ded1a26b6cf8474edb423727dd585d#egg=docker-compose'
@shin- link not working.. change to
pip install -e 'git+https://github.com/shin-/[email protected]#egg=docker-compose'
@gwdp Please don't mislead people. Compose 1.6.2 is certainly not what I'm encouraging you to test out.
Most helpful comment
If you are encountering this issue, please try out the potential fix in #4484 . You can use the following command: