Docker-py: DockerClient.images.pull() has inconsistent parameter naming

Created on 7 Feb 2017  路  2Comments  路  Source: docker/docker-py

The documentation for Images::pull states the usage as: pull(name, **kwargs). However, its Parameters description does not have 'name' but just has 'repository' (which used to work with the older low-level api client)

Looking at the code, the docker-py/docker/models/images.py has the function declared as:
def pull(self, name, **kwargs) and passes name, kwargs to the docker-py/docker/api/image.py:: ImageApiMixin::pull whose parameter is named repository (and not name).

The consequence is:
client.images.pull(repository=) fails with TypeError: pull() takes exactly 2 arguments (1 given) since it expects name though as per the documentation, repository should work.

client.images.pull(name=, repository=) fails with TypeError: pull() got multiple values for keyword argument 'repository' as the name parameter was passed in to the next method which interprets it as repository.

client.images.pull('image_name') - works - and works for a name that has registry / tag in it.

Given that under the wraps, we are accepting a repository format for this API, Can we just rename the only mandatory parameter as repository (from current 'name'). This would be consistent with the older behavior and to be consistent with the push api - and more in line with the actual default behavior when no parameter name is specified.

kinbug levedockerclient

Most helpful comment

@swagh1983 how does it work for registry and tag in it? whats the format?

All 2 comments

Thanks for the report - we'll look into it and figure out the best way to approach a fix.

@swagh1983 how does it work for registry and tag in it? whats the format?

Was this page helpful?
0 / 5 - 0 ratings