Open LewisGaul opened 2 months ago
It makes sense that the info is different as podman and docker work differently internally, so I'm not blaming them for this.
What I see is that we may need a better support for docker/podman differences. Looking at the popularity of Docker vs Podman: https://github.com/moby/moby vs https://github.com/containers/podman, I think it's fair to say that we should also support the kwirks of podman correctly.
Seeing long-term, I think we'll need better support for the podman/docker differences, but at the moment, would it be possible to fit the information of podman info into the DockerInfo pydantic model? Some fields won't be equivalent, but we can do a best effort here. What do you think?
What I see is that we may need a better support for docker/podman differences. Looking at the popularity of Docker vs Podman: https://github.com/moby/moby vs https://github.com/containers/podman, I think it's fair to say that we should also support the kwirks of podman correctly.
I'm happy to hear this :)
Seeing long-term, I think we'll need better support for the podman/docker differences, but at the moment, would it be possible to fit the information of podman info into the DockerInfo pydantic model? Some fields won't be equivalent, but we can do a best effort here. What do you think?
I'm not particularly keen on this idea, I'm not sure stuff would map very well and it would create transition friction if we then switch to handling it in a more complete way.
Do you have any initial thoughts on how we might support docker/podman differences in cases like this? One option would be to just return different objects based on which is being used, e.g. DockerSystemInfo
or PodmanSystemInfo
, which the caller would then have to handle appropriately. Alternatively something more like the pathlib
approach for Posix/Windows paths where you get either a DockerClient
or PodmanClient
object. The latter would probably be my preferred option, where we'd then just need to get the class hierarchy right to allow code sharing where desired.
I'm not particularly keen on this idea, I'm not sure stuff would map very well and it would create transition friction if we then switch to handling it in a more complete way. I understand, I saw this more as a quick win solution. But yeah if it creates more problems than it solves, let's drop it.
Concerning the option with DockerCLient and PodmanClient, indeed the whole difficulty will be with the class hierarchy.
One solution we can explore too, would be to make DockerClient
generic, like list or dict. See https://mypy.readthedocs.io/en/stable/generics.html for a detailed explanation.
We could have DockerClient["podman"]
and DockerClient["docker"]
and return the correct type depending on the situation.
This is arguably podman's fault for not maintaining compatibility with this command :(
Here's what you get from podman:
Is there anything we can do about this in PoW, or is the statement that we'll only support CLIs compatible with docker?