ansible returns with “Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6))

Question:

I am running myserver in ubuntu:

I use ansible and when I run it I get the following error:

when I run

I see:

and python versions are as follows:

Then as I see everything is fine and I am not sure why I get

in ansible?

Answer:

It appears that you don’t have the docker module installed.

You will need to install it via your system package manager (apt install python-docker, for example), or using pip (pip install docker).

If you have multiple Python versions, make sure that you’ve installed the docker module into the version that Ansible is using.

Leave a Reply