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
- ansibl
check file permissions and make sure your user can read the python module in /usr/lib/python2.7/site-packages
I recently went to this is issue but it was a permission problem.
Note that I used docker 1.9.1, ansible 2.0.1.0 and redhat 7.2.
I installed docker-py with ansible (this might not be your case).
I did it with this role:
- name: install docker-py with pip
become: true
pip: state=present name='{{ item }}'
with_item:
- docker-py==1.2.3
- six==1.10.0
When sudoing, ansible may install docker-py with default umask 0077. As a result, no user, except root, will be able to read docker-py module files.
Your playbook will result with the docker-py doesn't seem to be installed, but is required for the Ansible Docker module
error.
Notice the differences between:
sudo pip install docker-py
=> /usr/lib/python2.7/site-packages/docker
is in mode 0700sudo su
then pip install docker-py
=> /usr/lib/python2.7/site-packages/docker
is in mode 0755This will be fixable with ansible 2.1 by passing the umask=0022
parameter to the pip module (see https://github.com/ansible/ansible-modules-core/commit/4b46200477216dbcc54611d1c3e6f0cc83757aaf).
For now I fixed it by removing all packages installed in mode 0700:
pip uninstall -y six docker-py websocket_client
Then reinstalling them by hand:
sudo su
# now umask is 0022
pip install six==1.10.0 docker-py==1.2.3