Podman pods
Don't use the constructor directly. Instead use
from python_on_whales import DockerClient
podman = DockerClient(client_call=["podman"])
my_pod = podman.pod.inspect("my-pod-name")
# or
my_pod = podman.pod.create("my-pod-name")
For type hints, use this
from python_on_whales import Pod
def print_container_names(pod: Pod):
print([ctr.name for ctr in pod.containers])
Attributes
The attributes are the same that you get with the command line:
podman pod inspect ...
If you want to know the exact structure, you can go to the
podman pod inspect reference page
An example is worth many lines of descriptions.
In [1]: from python_on_whales import DockerClient
In [2]: podman = DockerClient(client_call=["podman"])
In [3]: pod = podman.pod.create("my-pod")
In [4]: def super_print(obj):
...: print(f"type={type(obj)}, value={obj}")
...:
In [5]: super_print(pod.id)
type = <class 'str'>, value = 4a5b3ad1655b394d25e9678d9688712183ccba1b43ec7f091c852d5c69f19934
In [6]: super_print(pod.name)
type = <class 'str'>, value = my-pod
In [7]: super_print(pod.created)
type = <class 'datetime.datetime'>, value = 2025-10-24 09:07:49.358680+00:00
In [8]: super_print(pod.state)
type = <class 'str'>, value = Created
In [9]: super_print(pod.num_containers)
type = <class 'int'>, value = 1
In [10]: super_print(pod.infra_container_id)
type = <class 'str'>, value = a15bfa2c670c4c4f4ed788fc84d88f73a18131847c0fe06c0bccffa89e44e627
In [11]: super_print(pod.shared_namespaces)
type = <class 'list'>, value = ['uts', 'ipc', 'net']
In [12]: super_print(pod.hostname)
type = <class 'str'>, value =
In [13]: super_print(pod.exit_policy)
type = <class 'str'>, value = continue
Methods
Pod
exists
exists()
Returns True if the pod exists and False if not.
See the podman.pod.exists command for information about the arguments.
kill
kill(*, signal=None)
Kill this pod
See the podman.pod.kill command for
information about the arguments.
logs
logs(container=None, *, names=False, since=None, tail=None, timestamps=False, until=None, follow=False, stream=False)
Returns the logs of the pod containers
See the podman.pod.logs command for
information about the arguments.
remove
remove(*, force=False, time=None)
Remove this pod.
See the podman.pod.remove command for
information about the arguments.
restart
restart()
Restart this pod.
See the podman.pod.restart command for
information about the arguments.
start
start()
Starts this pod.
See the podman.pod.start command for
information about the arguments.
stop
stop(*, time=None)
Stops this pod.
See the podman.pod.stop command for
information about the arguments.
unpause
unpause()
Unpause the pod
See the podman.pod.unpause command for
information about the arguments.