PodmanResource manager subclassed for Networks.

class PodsManager(client: APIClient = None)[source]

Bases: Manager

Specialized Manager for Pod resources.

Initialize Manager() object.


client – APIClient() configured to connect to Podman service.

create(name: str, **kwargs) Pod[source]

Create a Pod.

Keyword Arguments:

See (API documentation) – https://docs.podman.io/en/latest/_static/api.html#operation/CreatePod] for complete list of keywords.

exists(key: str) bool[source]

Returns True, when pod exists.

get(pod_id: str) Pod[source]

Return information for Pod by name or id.


pod_id – Pod name or id.

  • NotFound – when network does not exist

  • APIError – when error returned by service

list(**kwargs) List[Pod][source]

Report on pods.

Keyword Arguments:

filters (Mapping[str, str]) –

Criteria for listing pods. Available filters:

  • ctr-ids (List[str]): List of container ids to filter by.

  • ctr-names (List[str]): List of container names to filter by.

  • ctr-number (List[int]): list pods with given number of containers.

  • ctr-status (List[str]): List pods with containers in given state. Legal values are: “created”, “running”, “paused”, “stopped”, “exited”, or “unknown”

  • id (str) - List pod with this id.

  • name (str) - List pod with this name.

  • status (List[str]): List pods in given state. Legal values are: “created”, “running”, “paused”, “stopped”, “exited”, or “unknown”

  • label (List[str]): List pods with given labels.

  • network (List[str]): List pods associated with given Network Ids (not Names).


APIError – when an error returned by service

prepare_model(attrs: PodmanResource | Mapping[str, Any]) PodmanResourceType

Create a model from a set of attributes.

prune(filters: Dict[str, str] | None = None) Dict[str, Any][source]

Delete unused Pods.


  • PodsDeleted (List[str]): List of pod ids deleted.

  • SpaceReclaimed (int): Always zero.

Return type:

Dictionary Keys


APIError – when service reports error

remove(pod_id: Pod | str, force: bool | None = None) None[source]

Delete pod.

  • pod_id – Identifier of Pod to delete.

  • force – When True, stop and delete all containers in pod before deleting pod.

  • NotFound – when pod not found

  • APIError – when service reports an error


Podman only.

stats(**kwargs) List[Dict[str, Any]] | Iterator[List[Dict[str, Any]]][source]

Resource usage statistics for the containers in pods.

Keyword Arguments:
  • all (bool) – Provide statistics for all running pods.

  • name (Union[str, List[str]]) – Pods to include in report.

  • stream (bool) – Stream statistics until cancelled. Default: False.

  • decode (bool) – If True, response will be decoded into dict. Default: False.

  • NotFound – when pod not found

  • APIError – when service reports an error

property resource

prepare_model() will create Pod classes.