I'm trying to get docker-py working and am running into a fundamental issue that may not be related to docker-py at all.
I installed docker-py via pip (here's the output of re-running it - should answer version questions):
>pip install docker-py
Requirement already satisfied: docker-py in /usr/local/lib/python2.7/site-packages
Requirement already satisfied: docker-pycreds>=0.2.1 in /usr/local/lib/python2.7/site-packages (from docker-py)
Requirement already satisfied: backports.ssl-match-hostname>=3.5; python_version < "3.5" in /usr/local/lib/python2.7/site-packages (from docker-py)
Requirement already satisfied: ipaddress>=1.0.16; python_version < "3.3" in /usr/local/lib/python2.7/site-packages (from docker-py)
Requirement already satisfied: requests!=2.11.0,>=2.5.2 in /usr/local/lib/python2.7/site-packages (from docker-py)
Requirement already satisfied: six>=1.4.0 in /usr/local/lib/python2.7/site-packages (from docker-py)
Requirement already satisfied: websocket-client>=0.32.0 in /usr/local/lib/python2.7/site-packages (from docker-py)
Trying to execute some of the code samples (from http://containertutorials.com/py/docker-py.html) and am failing right out the gate:
>python
Python 2.7.13 (default, Dec 17 2016, 23:03:43)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from docker import client
>>> cli = Client(base_url='unix://var/run/docker.sock')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'Client' is not defined
I get a similar failure trying a different code example that leverages AutoVersionClient (client = AutoVersionClient(base_url='unix://var/run/docker.sock')
) but that fails with the similar AutoVersionClient not defined.
This sure feels like a core configuration issue on my system, but I've no idea where the problem lies.