haxorof/ansible-role-docker-ce

docker-compose won't install

mhow2 opened this issue · 9 comments

mhow2 commented

when I set docker_compose: true , I get an error ImportError: No module named setuptools

Here is the output of the pip2 command when I run it by hand on the host (debian 9):

$ sudo pip2 install docker-compose
Collecting docker-compose
  Using cached https://files.pythonhosted.org/packages/2e/57/4f02ad084b637e00d7f430562b1cba24321e5d6eb59aecad2a6b760ebc18/docker_compose-1.23.1-py2.py3-none-any.whl
Collecting six<2,>=1.3.0 (from docker-compose)
  Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting jsonschema<3,>=2.5.1 (from docker-compose)
  Using cached https://files.pythonhosted.org/packages/77/de/47e35a97b2b05c2fadbec67d44cfcdcd09b8086951b331d82de90d2912da/jsonschema-2.6.0-py2.py3-none-any.whl
Collecting backports.ssl-match-hostname>=3.5; python_version < "3.5" (from docker-compose)
  Using cached https://files.pythonhosted.org/packages/76/21/2dc61178a2038a5cb35d14b61467c6ac632791ed05131dda72c20e7b9e23/backports.ssl_match_hostname-3.5.0.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ImportError: No module named setuptools
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-zYAPwH/backports.ssl-match-hostname/

Thanks @mhow2 for reporting this!

I see there is issues with this to install docker-compose in different distributions and also how you install it. Just for me to know a bit more about your setup:

  • Is the your Debian installation fully upgraded?
  • Is this a desktop or server environment?
  • Do you usually use pip? If so, do you install with --user flag or in a python virtual environment?

Cheers!

Also another question:

  • How do you plan to use docker-compose? Using it via command-line and/or via Ansible using the module docker_service?
mhow2 commented
* Is the your Debian installation fully upgraded?

Yes. I have another ansible role that takes care of updating the system (it runs beforehand).

* Is this a desktop or server environment?

Server.

* Do you usually use pip? If so, do you install with `--user` flag or in a python virtual environment?

usually no. Whenever it's possible, I try to rely on python libraries distributed within official debian packages. I did not find where pip2 install is invoked from the role ? anyhow I need your help :)

Also another question:

* How do you plan to use docker-compose? Using it via command-line and/or via Ansible using the module `docker_service`?

via command-line.

Thanks @mhow for answering my questions.

I have revisit the how installation is done with compose etc so on the master right now I created another config which is more for your use case where you want to run docker-compose from command-line.

can you try using the master of this role and instead of docker_compose you shall use docker_compose_no_pip. Possible for you to try this?

Cheers!

mhow2 commented

Can you lead me to the file which tells what it's done underneath with docker_compose_no_pip ?
FYI I don't rely on debian's packaging for docker-compose anymore, their package is outdated and don't works well concurently with docker.io's own package. Usually, I'm using the "official" sudo curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose as documented in https://docs.docker.com/compose/install/#install-compose

Sure. When you use that new variable then it follow the official way and you find it in the bottom of this file: https://github.com/haxorof/ansible-role-docker-ce/blob/master/tasks/postinstall.yml

mhow2 commented

Thanks ! The new variable/method seems to work like a charm, at least on my system :) Cheers

That's great news! Many thanks for testing it.

mhow commented