pods

Pod 资源的模型和管理器。

class Pod(attrs: Mapping[str, Any] | None = None, client: APIClient | None = None, collection: Manager | None = None, podman_client: PodmanClient | None = None)[源]

基类:PodmanResource

由 Podman 服务管理的 Pod 的详细信息和配置。

初始化 PodmanResource 的基类。

参数:
  • attrs – Podman 服务资源属性的映射。

  • client – Podman 服务的配置连接。

  • collection – 此类资源的管理器,为了兼容性命名为 collection

  • podman_client – 配置为连接到 Podman 对象的 PodmanClient()。

kill(signal: str | int | None = None) None[源]

向 Pod 发送信号。

参数:

signal – 要发送给 Pod 的信号。

抛出:
  • NotFound – 未找到 Pod 时

  • APIError – 服务报告错误时

pause() None[源]

暂停 Pod。

抛出:
  • NotFound – 未找到 Pod 时

  • APIError – 服务报告错误时

reload(**kwargs) None

从服务刷新此对象的数据。

关键字参数:

compatible (bool) – 使用 Docker 兼容端点

remove(force: bool | None = None) None[源]

删除 Pod。

参数:

force – 为 True 时,在删除 Pod 之前停止并删除 Pod 中的所有容器。

抛出:
  • NotFound – 未找到 Pod 时

  • APIError – 服务报告错误时

restart() None[源]

重启 Pod。

抛出:
  • NotFound – 未找到 Pod 时

  • APIError – 服务报告错误时

start() None[源]

启动 Pod。

抛出:
  • NotFound – 未找到 Pod 时

  • APIError – 服务报告错误时

stop(timeout: None | int | tuple[int, int] | tuple[int, None] = None) None[源]

停止 Pod。

抛出:
  • NotFound – 未找到 Pod 时

  • APIError – 服务报告错误时

top(**kwargs) dict[str, Any][源]

报告 Pod 中正在运行的进程。

关键字参数:

ps_args (str) – 传递给 ps 的可选参数。

抛出:
  • NotFound – 未找到 Pod 时

  • APIError – 服务报告错误时

unpause() None[源]

取消暂停 Pod。

抛出:
  • NotFound – 未找到 Pod 时

  • APIError – 服务报告错误时

property id

返回对象的标识符。

类型:

str

manager: PodsManager
property name

返回 Pod 的名称。

类型:

str

property short_id

返回截断的标识符。当包含在 id 中时,保留“sha256”。

不尝试确保返回的值对所有资源都具有语义意义。

类型:

str