[PR #389/a44e0736 backport][stable-1] Improve/fix API version handling #391
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a backport of PR #389 as merged into main (a44e073).
SUMMARY
Right now we retrieve the API version (the latest one supported by the daemon!) from the Docker daemon after creating the Docker SDK for Python API client. If the
version
module/plugin parameter is used, we should use that version instead, and if it is not used, the Python API client already retrieved that version for us. So let's safe one API call and use the API version supplied by the Python API client.(The property exists since Docker SDK for Python 1.5.0: docker/docker-py@7a6980d We require version 1.8.0 or newer, so we can depend on it.)
ISSUE TYPE
COMPONENT NAME
Docker SDK for Python based plugins and modules