Podman: Python scripting for Podman services¶
PodmanPy is a Python3 module that allows you to write Python scripts that access resources maintained by a Podman service. It leverages the Podman service RESTful API.
Podman services are addressed using a URL where the scheme signals to the client how to connect to
service. Supported schemes are: http+ssh
, http+unix
or tcp
. Formats are the following styles:
http+ssh://[<login>@]<hostname>[:<port>]/<full filesystem path>
http+ssh://alice@api.example:22/run/user/1000/podman/podman.sock
The scheme
ssh
is excepted as an alias
http+unix://<full filesystem path>
http+unix:///run/podman/podman.sock
The scheme
unix
is excepted as an alias
tcp://<hostname>:<port>
tcp://api.example:8888
Example¶
1 import podman
2
3 with podman.Client() as client:
4 if client.ping():
5 images = client.images.list()
6 for image in images:
7 print(image.id)