docker-py icon indicating copy to clipboard operation
docker-py copied to clipboard

Documentation for "images" is incorrect?

Open ns-cweber opened this issue 5 years ago • 3 comments

This page says that it documents the methods on client.images, but client has no images attribute.

$  python
Python 3.6.4 (default, Aug 22 2019, 12:24:29) 
[GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import docker
>>> docker.client.images
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'docker.client' has no attribute 'images'
>>> docker.__version__
'1.10.6'

I also thought perhaps the documentation meant "...methods on Client.images" (the class instead of the module?), and while Client.images does indeed exist, it's apparently a method for listing the images, not an object with methods for building, tagging, pushing, etc as the docs portray it.

I'm not sure if I'm doing something wrong or if the docs are just outdated?

Also, the docs talk about a DockerClient class (https://docker-py.readthedocs.io/en/latest/client.html#client-reference) and they even give an example

import docker
client = docker.DockerClient(base_url='unix://var/run/docker.sock')

But this errors for me: *** AttributeError: module 'docker' has no attribute 'DockerClient'

Also, I did a pip --force-reinstall docker-py to be sure I was running the right version.

ns-cweber avatar Sep 28 '19 03:09 ns-cweber

EDIT: I think the issue is that there are two different packages out there with different APIs that both point to the same docs and the same github page. I downloaded docker-py, but apparently this is an old version, although I didn't see anything obvious telling me that it was deprecated or otherwise pointing me to docker, and in fact the docker-py pypi page even claims to be the latest stable version:

Installation
The latest stable version is always available on PyPi.
pip install docker-py

ns-cweber avatar Sep 28 '19 03:09 ns-cweber

Hi @ns-cweber. This change was confusing, and the official package is docker.

@shin- can you edit pypi page to redirect to the correct package or something like that? Thanks.

feliperuhland avatar Sep 29 '19 14:09 feliperuhland

Ran into this myself and happened to find issue #2542 first.

Even better would be to send it one last update to init.py

import warnings
warnings.warn("deprecated", DeprecationWarning)

bailey-dojofive avatar Mar 15 '22 21:03 bailey-dojofive