NAME 名称

podman-container-prune - Remove all stopped containers from local storage
podman-container-prune - 从本地存储中删除所有已停止的容器

SYNOPSIS 概要

podman container prune [options]
podman 容器清理 [选项]

DESCRIPTION 描述

podman container prune removes all stopped containers from local storage.
podman 容器清理会从本地存储中删除所有已停止的容器。

OPTIONS 选项

--filter=filters

Provide filter values. 提供过滤器值。

The filters argument format is of key=value. If there is more than one filter, then pass multiple OPTIONS: --filter foo=bar --filter bif=baz.
过滤器参数格式为 key=value 。如果有多个过滤器,则传递多个选项:--filter foo=bar --filter bif=baz。

Supported filters: 支持的过滤器:

Filter

Description

label

Only remove containers, with (or without, in the case of label!=[…] is used) the specified labels.
仅删除具有(或不具有,在使用 label!=[…] 的情况下)指定标签的容器。

until

Only remove containers created before given timestamp.
仅删除在给定时间戳之前创建的容器。

The label filter accepts two formats. One is the label=key or label=key=value, which removes containers with the specified labels. The other format is the label!=key or label!=key=value, which removes containers without the specified labels.
label 过滤器接受两种格式。一种是 label =key 或 label =key=value,用于移除具有指定标签的容器。另一种格式是 label! =key 或 label! =key=value,用于移除不具有指定标签的容器。

The until filter can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. 10m, 1h30m) computed relative to the machine’s time.
until 过滤器可以是 Unix 时间戳、日期格式化的时间戳,或者是相对于机器时间计算的 Go 时长字符串(例如 10m,1h30m)。

--force, -f

Do not provide an interactive prompt for container removal.
不要为容器移除提供交互式提示。

The default is false.
默认值为 false。

-h, --help -h,--帮助

Print usage statement. 打印使用说明。
The default is false.
默认值为 false。

EXAMPLES 示例

Remove all stopped containers from local storage:
从本地存储中删除所有已停止的容器:

$ podman container prune
WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N] y
878392adf2e6c5c9bb1fc19b69d37d2e98c8abf9d539c0bce4b15b46bbcce471
37664467fbe3618bf9479c34393ac29c02696675addf1750f9e346581636cde7
ed0c6468b8e1cb641b4621d1fe30cb477e1fefc5c0bceb66feaf2f7cb50e5962
6ac6c8f0067b7a4682e6b8e18902665b57d1a0e07e885d9abcd382232a543ccd
fff1c5b6c3631746055ec40598ce8ecaa4b82aef122f9e3a85b03b55c0d06c23
602d343cd47e7cb3dfc808282a9900a3e4555747787ec6723bb68cedab8384d5

Remove all stopped containers from local storage without confirmation:
从本地存储中删除所有已停止的容器,无需确认:

$ podman container prune -f
878392adf2e6c5c9bb1fc19b69d37d2e98c8abf9d539c0bce4b15b46bbcce471
37664467fbe3618bf9479c34393ac29c02696675addf1750f9e346581636cde7
ed0c6468b8e1cb641b4621d1fe30cb477e1fefc5c0bceb66feaf2f7cb50e5962
6ac6c8f0067b7a4682e6b8e18902665b57d1a0e07e885d9abcd382232a543ccd
fff1c5b6c3631746055ec40598ce8ecaa4b82aef122f9e3a85b03b55c0d06c23
602d343cd47e7cb3dfc808282a9900a3e4555747787ec6723bb68cedab8384d5

Remove all stopped containers from local storage created before the last 10 minutes:
删除在最近 10 分钟之前创建的所有已停止的容器

$ podman container prune --filter until="10m"
WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N] y
3d366295e33d8cc612c4d873199bacadd55088d90d17dcafaa9a2d317ad50b4e

SEE ALSO 参见 ¶

podman(1), podman-ps(1)

HISTORY 历史 ¶

December 2018, Originally compiled by Brent Baude bbaude@redhat.com
2018 年 12 月,最初由 Brent Baude bbaude@redhat.com 编译

December 2020, converted filter information from docs.docker.com documentation by Dan Walsh dwalsh@redhat.com
2020 年 12 月,由 Dan Walsh dwalsh@redhat.com 从 docs.docker.com 文档中转换的过滤器信息