Centos7 docker-py doesn't seem to be installed

jzoric picture jzoric · May 20, 2015 · Viewed 11.1k times · Source

I installed Centos7 minimal and then: ansible, docker, pip and using pip I installed docker-py.

Versions:
- Docker version 1.6.0, build 8aae715/1.6.0
- ansible 1.9.1
- docker_py-1.2.2

Trying to run a playbook, for example

- name: redis container
  docker:
    name: myredis
    image: redis
    state: started

i get msg: docker-py doesn't seem to be installed, but is required for the Ansible Docker module.

I can't see the problem. Is it the CentOS, docker and ansible version?

PS: I disabled the firewalld and SELinux

Any ideas? Thanks

Answer

Johnny Z picture Johnny Z · Jun 17, 2015

I found a couple problems with the docker-py module. After I worked through them I ended up with this:

  - name: Docker-PY
    pip:
      name: "{{ item }}"
    with_items:
    - six==1.4
    - docker-py==1.1.0

First, I ran into your problem. The solution is to explicitly set the most recent version of six as described here: https://github.com/docker/docker-py/issues/344.

After that, I ran into an issue (you might run into it too) with a bug in the docker-py 1.2.2 version. The workaround is to specify an older version as described here: https://github.com/ansible/ansible-modules-core/issues/1227. Do a pip uninstall docker-py to get rid of the newer version.

If you aren't using ansible to install these then do this:

[sudo] pip uninstall docker-py
[sudo] pip install six==1.4
[sudo] pip install docker-py==1.1.0