DockerClient.version() falls back to trying '--version' #213
Open
renat1sakenov wants to merge 2 commits intojenkinsci:masterfrom
Open
DockerClient.version() falls back to trying '--version' #213renat1sakenov wants to merge 2 commits intojenkinsci:masterfrom
renat1sakenov wants to merge 2 commits intojenkinsci:masterfrom
Conversation
…ing null This is added in an attempt to make this plugin compatible with podman, where '-v' does not work.
95jonpet
suggested changes
Sep 29, 2020
95jonpet
left a comment
There was a problem hiding this comment.
The --version option can be used with both docker and podman. Thus, the code can be simplified.
| @@ -251,9 +251,12 @@ public void rm(@Nonnull EnvVars launchEnv, @Nonnull String containerId) throws I | |||
| LaunchResult result = launch(new EnvVars(), true, "-v"); | |||
There was a problem hiding this comment.
Why just not use the --version option? It is supported by both docker (see https://docs.docker.com/engine/reference/commandline/cli/) and podman.
Suggested change
| LaunchResult result = launch(new EnvVars(), true, "-v"); | |
| LaunchResult result = launch(new EnvVars(), true, "--version"); |
This way, there is no need to add another if-statement if the -v option fails.
Contributor
|
The |
Author
|
Fully agree, I commited the change to only check for --version. |
Contributor
|
ping @rsandell |
95jonpet
approved these changes
Feb 6, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hello.
As far as I can tell, only '-v' option is used to determine the docker version.
I added a fallback to check again for '--version', since I'm trying to make this run with podman instead of docker. Podman does not support the '-v' flag.
Best,
Renat