containers / podman-py

Python bindings for Podman's RESTful API
Apache License 2.0
252 stars 94 forks source link

Q: can podman-py be used as a drop in replacement for the docker python module? #336

Closed TTimo closed 11 months ago

TTimo commented 1 year ago

Hello,

I am looking at switching or adding support to a set of scripts that use the docker python api - does podman have a compatible API, at least for the most common high level functionality so that I could use this module as a drop in replacement?

baude commented 1 year ago

if can just use docker-py and point it to the podman system service (socket). podman-py is not a replacement for docker-py per se, it is a python binding for podman and it uses podman's special endpoints adn special sauce. does this all make sense?

jwhonce commented 1 year ago

Hello,

I am looking at switching or adding support to a set of scripts that use the docker python api - does podman have a compatible API, at least for the most common high level functionality so that I could use this module as a drop in replacement?

At the source level, yes. You do not need to rewrite your docker-py code assuming your server is podman. If you want to point podman-py to a docker backend you need to add the compatible flag to your calls. This is bench checked, I do not believe there are any tests to ensure everything works as expected.

The podman server has compatibility endpoints to support the docker API and an specialized set of endpoints for podman. podman-py defaults to talking to a podman server.

TTimo commented 11 months ago

Thank you. I did not get to try this yet, but this was valuable feedback.