Unexpected behavior from docker-py client

I'm trying to run some basic code from the Getting Started documentation () 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: ), as the documentation seems to suggest? I must be missing something simple. Any ideas?

1 Answer

Figured it out. I had pip installed docker-py, but the current version of the package is simply called "docker" on pypi.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like