Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DockerClient.version() falls back to trying '--version' #213

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

renat1sakenov
Copy link

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

…ing null

This is added in an attempt to make this plugin compatible with podman, where '-v' does not work.
Copy link

@95jonpet 95jonpet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@offa
Copy link
Contributor

offa commented Apr 28, 2021

The -v shorthand is available with podman 1.6 (again) . However, as @95jonpet I'd prefer --version, especially to avoid confusion with --volume's shorthand.

@renat1sakenov
Copy link
Author

Fully agree, I commited the change to only check for --version.

@offa
Copy link
Contributor

offa commented Feb 4, 2022

ping @rsandell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants