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

Compatibility with Docker CLI #23344

Open
ch0fe opened this issue Jul 19, 2024 · 10 comments
Open

Compatibility with Docker CLI #23344

ch0fe opened this issue Jul 19, 2024 · 10 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@ch0fe
Copy link

ch0fe commented Jul 19, 2024

Feature request description

Currently, podman version and podman info do not list some of the version information that would be available on docker version and docker info. It would be nice if this could be addressed, making podman (esp. podman compose) compatible with tools that rely on this, concretely the docker-compose ansible module (ansible-collections/community.docker#891).

Suggest potential solution

The output should be compatible to what tools expect from docker commands.

Have you considered any alternatives?

Not using podman when relying on these integrations.

Additional context

No response

@ch0fe ch0fe added the kind/feature Categorizes issue or PR as related to a new feature. label Jul 19, 2024
@Luap99
Copy link
Member

Luap99 commented Jul 19, 2024

please provide exact examples of what is needed. How does the docker output look like compared to podman and what keys does the ansible role care about?

@ch0fe
Copy link
Author

ch0fe commented Jul 19, 2024

docker version includes info on the client and server version:

    "Client": {
        "CloudIntegration": "v1.0.35+desktop.4",
        "Version": "24.0.6",
        "ApiVersion": "1.43",
        "DefaultAPIVersion": "1.43",
        "GitCommit": "ed223bc",
        "GoVersion": "go1.20.7",
        "Os": "windows",
        "Arch": "amd64",
        "BuildTime": "Mon Sep  4 12:32:48 2023",
        "Context": "default"
    },
    "Server": {
        "Platform": {
            "Name": "Docker Desktop 4.23.0 (120376)"
        },
        "Components": [
            {
                "Name": "Engine",
                "Version": "24.0.6",
                "Details": {
                    "ApiVersion": "1.43",
                    "Arch": "amd64",
                    "BuildTime": "Mon Sep  4 12:32:16 2023",
                    "Experimental": "false",
                    "GitCommit": "1a79695",
                    "GoVersion": "go1.20.7",
                    "KernelVersion": "5.10.102.1-microsoft-standard-WSL2",
                    "MinAPIVersion": "1.12",
                    "Os": "linux"
                }
            },
            {
                "Name": "containerd",
                "Version": "1.6.22",
                "Details": {
                    "GitCommit": "8165feabfdfe38c65b599c4993d227328c231fca"
                }
            },
            {
                "Name": "runc",
                "Version": "1.1.8",
                "Details": {
                    "GitCommit": "v1.1.8-0-g82f18fe"
                }
            },
            {
                "Name": "docker-init",
                "Version": "0.19.0",
                "Details": {
                    "GitCommit": "de40ad0"
                }
            }
        ],
        "Version": "24.0.6",
        "ApiVersion": "1.43",
        "MinAPIVersion": "1.12",
        "GitCommit": "1a79695",
        "GoVersion": "go1.20.7",
        "Os": "linux",
        "Arch": "amd64",
        "KernelVersion": "5.10.102.1-microsoft-standard-WSL2",
        "BuildTime": "2023-09-04T12:32:16.000000000+00:00"
    }
}

podman version only includes info on the client:

{
    "Client": {
        "APIVersion": "4.9.4-rhel",
        "Version": "4.9.4-rhel",
        "GoVersion": "go1.21.11 (Red Hat 1.21.11-1.el9_4)",
        "GitCommit": "",
        "BuiltTime": "Tue Jul  9 06:01:17 2024",
        "Built": 1720519277,
        "OsArch": "linux/amd64",
        "Os": "linux"
    }
}

docker info includes info on the compose plugin in ClientInfo.Plugins:

{
        "SchemaVersion": "0.1.0",
        "Vendor": "Docker Inc.",
        "Version": "v2.21.0-desktop.1",
        "ShortDescription": "Docker Compose",
        "Name": "compose",
        "Path": "C:\\Program Files\\Docker\\cli-plugins\\docker-compose.exe"
      }

podman info does not.

The Ansible module in question wants to read Server.ApiVersion from docker version and expects a compose plugin in ClientInfo.Plugins from docker info

@afbjorklund
Copy link
Contributor

afbjorklund commented Jul 19, 2024

You need to use podman --remote version

And probably need docker version for ApiVersion?

But docker-compose is a standalone binary, it is not a plug-in (with Podman)

$ docker-compose version
Docker Compose version v2.28.1
$ docker-buildx version
github.com/docker/buildx v0.16.0 10c9ff901c1c255b58969dd2ade4789acbbab3bb

@afbjorklund
Copy link
Contributor

afbjorklund commented Jul 19, 2024

Podman client will say: (i.e. libpod socket)

"APIVersion": "5.1.2",
"Version": "5.1.2",

Docker client will say: (i.e. compat socket)

"Version": "5.1.2",
"ApiVersion": "1.41",
"MinAPIVersion": "1.24",

Most likely a Docker client would expect the Docker API version, and not the Podman API version.

So you can't really use podman-docker to emulate the docker client, but need to use a real client...

i.e. install docker and docker-compose

not podman-docker and podman-compose

@Luap99
Copy link
Member

Luap99 commented Jul 22, 2024

Yes using the docker client against the podman server might be better in this case.

If the tool is trying to use the libpod API version it will not result in something useful and depending on how they handle it cause it to error out anyway.

@afbjorklund
Copy link
Contributor

Currently they just return errors, rather than trying to support docker-compose or podman APIVersion:

        if not isinstance(cli_info.get('ClientInfo'), dict):
            self.fail('Cannot determine Docker client information. Are you maybe using podman instead of docker?')
        for plugin in cli_info['ClientInfo'].get('Plugins') or []:
            if not isinstance(self._version.get('Server'), dict) or not isinstance(self._version['Server'].get('ApiVersion'), string_types):
                self.fail('Cannot determine Docker Daemon information. Are you maybe using podman instead of docker?')
            self.docker_api_version_str = to_native(self._version['Server']['ApiVersion'])

The error message would be bettter as "Are you maybe using podman client instead of docker client?"

Copy link

A friendly reminder that this issue had no activity for 30 days.

@flxmr
Copy link

flxmr commented Aug 22, 2024

because this had some activity and my problem is related: I have a symlink docker -> podman. Now if I run docker --version on my shell, I get podman version .... However, if I run docker --version within a script, I get docker version .... But it's still podman running. What is going on there?

@afbjorklund
Copy link
Contributor

afbjorklund commented Aug 22, 2024

You probably installed the "podman-docker" package, instead of the "docker-ce-cli" (or "moby-engine") package.

Note: The real client will say "Docker version".

$ podman --version
podman version 4.9.3
$ docker --version
Docker version 27.1.1, build 6312585

The first word is just $0 (name of symlink)

@flxmr
Copy link

flxmr commented Aug 22, 2024

So capital d?! - very weird, now tried on Fedora and here it behaves consistently at least - however it has a different minor version (4.9.3 -> 4.9.4). But yes, I checked with bash -c "docker info" (and which) and I'm calling the podman-executable with the symlink. Weird.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

4 participants