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

podman version --json should include .Client.Platform.Name #20818

Closed
felipecrs opened this issue Nov 28, 2023 · 5 comments
Closed

podman version --json should include .Client.Platform.Name #20818

felipecrs opened this issue Nov 28, 2023 · 5 comments
Labels
jetsam "...cargo that is cast overboard to lighten the load in time of distress" kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@felipecrs
Copy link

felipecrs commented Nov 28, 2023

Issue Description

I am trying to use podman's docker CLI compatibility, but some scripts I have rely on the output of docker version --json to decide whether the version of docker is good enough or not.

podman version should include the client name, so that scripts can detect when the client is podmand and decide what to do in such case, like for example, checking the minimum supported version of podman.

Steps to reproduce the issue

$ docker version --format '{{.Client | json}}' | jq .
{
  "Platform": {
    "Name": "Docker Engine - Community"
  },
  "Version": "24.0.7",
  "ApiVersion": "1.43",
  "DefaultAPIVersion": "1.43",
  "GitCommit": "afdd53b",
  "GoVersion": "go1.20.10",
  "Os": "linux",
  "Arch": "amd64",
  "BuildTime": "Thu Oct 26 09:08:01 2023",
  "Context": "default"
}

$ podman version --format '{{.Client | json}}' | jq .
{

  "APIVersion": "4.6.1",
  "Version": "4.6.1",
  "GoVersion": "go1.20.6",
  "GitCommit": "",
  "BuiltTime": "Mon Oct  9 16:15:55 2023",
  "Built": 1696868155,
  "OsArch": "linux/amd64",
  "Os": "linux"
}

Describe the results you received

See above.

Describe the results you expected

$ podman version --format '{{.Client | json}}' | jq .
{
  "Platform": {
    "Name": "Podman"
  },
  "APIVersion": "4.6.1",
  "Version": "4.6.1",
  "GoVersion": "go1.20.6",
  "GitCommit": "",
  "BuiltTime": "Mon Oct  9 16:15:55 2023",
  "Built": 1696868155,
  "OsArch": "linux/amd64",
  "Os": "linux"
}

podman info output

N/A

Podman in a container

No

Privileged Or Rootless

None

Upstream Latest Release

Yes

Additional environment details

N/A

Additional information

N/A

@felipecrs felipecrs added the kind/bug Categorizes issue or PR as related to a bug. label Nov 28, 2023
@felipecrs
Copy link
Author

One caveat however is that very old versions of docker, like 17.04, won't have this key set either.

@Luap99
Copy link
Member

Luap99 commented Nov 29, 2023

Generally speaking version checks are not that great especially considering the RHEL world where also features are backported sometimes. It is much better to actually check for the features you need if possible.

It is not clear to me how much .Client.Platform.Name would help you with that either. Assuming you have a script you either call podman or docker so you should already know what you are using. Or are you worried about users symlinking docker -> podman?

@felipecrs
Copy link
Author

Generally speaking version checks are not that great especially considering the RHEL world where also features are backported sometimes. It is much better to actually check for the features you need if possible.

That ain't a bad idea. I guess I can do:

if docker run --help | grep -w -- --quiet; then
  supports_quiet=true
else
  supports_quiet=false
fi

It is not clear to me how much .Client.Platform.Name would help you with that either.

I would be able to perform different version range comparisons depending on the client.

Assuming you have a script you either call podman or docker so you should already know what you are using.

I see your point, but my intention was to make the transition as transparent as possible. I didn't want to refactor my whole scripts. Also, my scripts are not meant to have first class support for podman.

Or are you worried about users symlinking docker -> podman?

Exactly. My scripts require docker, but I don't want to reject users if they decide to symlink or shim docker to podman.

This is a little worse considering that on RHEL 8 yum install docker actually installs podman and creates the docker shim.

@felipecrs
Copy link
Author

felipecrs commented Nov 29, 2023

All that said, I quite like your idea of checking the features. That's smart. If you don't believe this issue is worth implementing then, please close it.

@Luap99 Luap99 added the jetsam "...cargo that is cast overboard to lighten the load in time of distress" label Apr 4, 2024
@Luap99
Copy link
Member

Luap99 commented Apr 4, 2024

Given you seem to have a solution and nobody else has brought up this difference in the meantime I am going to close it and assume it is not really needed in practice

@Luap99 Luap99 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 4, 2024
@stale-locking-app stale-locking-app bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Jul 4, 2024
@stale-locking-app stale-locking-app bot locked as resolved and limited conversation to collaborators Jul 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
jetsam "...cargo that is cast overboard to lighten the load in time of distress" kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

2 participants