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 = 1e8c42cf47b693755334b82baa69d596cf487a60774e3df25f46417979ff420a
In [6]: super_print(pod.name)
type = <class 'str'>, value = my-pod
In [7]: super_print(pod.created)
type = <class 'datetime.datetime'>, value = 2026-03-09 14:18:11.782050+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 = 0c1d141f38867b9cdd281542e5838c79a05dc74a36c9ebe54f8c956bb59e88ea
In [11]: super_print(pod.shared_namespaces)
type = <class 'list'>, value = ['ipc', 'net', 'uts']
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.