Set image default tag on pull#2671
Conversation
|
Looks like a duplicate of #2656 |
|
With this change, will it still be possible to achieve the "pull all tags" behavior? (i.e. to implement "docker pull --all-tags ..." ? |
8083aee to
1f4a790
Compare
Oops, don't think so. Let me try something else. |
a42be80 to
e89a080
Compare
| def pull(self, repository, tag='latest', **kwargs): | ||
| """ | ||
| Pull an image of the given name and return it. Similar to the | ||
| ``docker pull`` command. |
There was a problem hiding this comment.
The wording of the docstring should be updated to make it more clear. E.g.:
If no tag is specified, all tags from that repository will be pulled.
should be
If tag is None, all tags from that repository will be pulled.
b67e580 to
1d09f93
Compare
docker/api/image.py
Outdated
| return self._result(self._post(url, params=params), True) | ||
|
|
||
| def pull(self, repository, tag=None, stream=False, auth_config=None, | ||
| def pull(self, repository, tag='latest', stream=False, auth_config=None, |
There was a problem hiding this comment.
Thinking out loud: would it work to add an all_tags parameter, and based on that either keep None as None, or set None -> latest ?
Train of thought is that if you want to pull all tags, no tag is allowed to be set, so it feels a bit more natural to having a separate option (the original "no tag means all tags" is a bit awkward, and, well, bad choices in the past)
There was a problem hiding this comment.
@thaJeztah I added an all_tags parameter to the pull methods. Is the logic ok? If we set it, we ignore any tag set with tag or repository parameter.
Signed-off-by: aiordache <anca.iordache@docker.com>
1c73240 to
cec152d
Compare
docker/models/images.py
Outdated
| Returns: | ||
| (:py:class:`Image` or list): The image that has been pulled. | ||
| If no ``tag`` was specified, the method will return a list | ||
| If ``tag`` is None, the method will return a list |
There was a problem hiding this comment.
I think this comment needs updating. Should it be something like this?
The image that has been pulled. If
all_tagsis True, then the method will return a list of :py:class:Imageobjects belonging to this repository.
| If no tag is specified, all tags from that repository will be | ||
| pulled. | ||
| If ``all_tags`` is set, the ``tag`` parameter is ignored and all image | ||
| tags will be pulled. |
There was a problem hiding this comment.
Even though it's intuitive, it's probably good to add explicit documentation that if tag is None or empty, then it will be set to "latest". Also in the api.image module.
Signed-off-by: aiordache <anca.iordache@docker.com>
|
@thaJeztah PTAL |
Set default tag to
lateston pull.Resolves #2545