I'm trying to run some basic code from the Getting Started documentation (https://docker-py.readthedocs.io/en/stable/index.html#getting-started) for the docker-py package, but am running into problems in both Python 2.7.6 and Python 3.4.3:
>>> client = docker.from_env()
>>> client.images.list()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'function' object has no attribute 'list'
Strangely, I can see a list of images with this:
client.images()
[{u'Created': 1476822682, u'Labels': None, u'VirtualSize': 4802964, u'ParentId': u'', u'RepoTags': [u'alpine:3.4'], u'RepoDigests': [u'alpine@sha256:1354db23ff5478120c980eca1611a51c9f2b88b61f24283ee8200bf9a54f2e5c'], u'Id': u'sha256:baa5d63471ead618ff91ddfacf1e2c81bf0612bfeb1daf00eb0843a41fbfade3', u'Size': 4802964}]
According to the docs, this would seem to be unexpected behavior. Why is client.images a list and not an instance of the Images class (as seen here: https://docker-py.readthedocs.io/en/stable/images.html), as the documentation seems to suggest? I must be missing something simple. Any ideas?
Figured it out. I had pip installed docker-py, but the current version of the package is simply called "docker" on pypi.