发布日期: 2025-07-25
版本号: v5.6.0-rc1

Podman发布了重要更新,新增了管理Quadlet的系列命令(安装、列表、打印、删除),并扩展了Quadlet单元文件的功能,例如支持容器环境变量从宿主机读取、Pod单元增加标签和退出策略、镜像单元增加拉取策略、网络单元指定接口名称等。命令行工具方面,podman machine init新增--swap选项,--mount支持dest=别名,podman kube play支持限制CPU核心和内存节点、指定停止信号,同时多个命令(如卷导入导出、构建上下文、卷创建指定UID/GID、密钥创建忽略存在、拉取策略、Artifact挂载文件名、tmpfs的noatime、更新最新容器等)得到增强。错误修复涵盖了安全选项解析、容器停止进程误杀、机器初始化时区与权限、Quadlet单元名称生成与挂载依赖、Windows平台兼容性等多方面问题。API新增了完整的Artifact管理接口,并修复了容器状态显示、健康检查超时处理、JSON转义等兼容性问题。此外,系统优化包括Quadlet停止容器方式改进、构建时动态链接sqlite3以减小二进制体积,以及更新了Buildah、containers/common、containers/storage和containers/image等依赖库。

更新内容 (中文)

功能

  • 新增了一组用于管理 Quadlet 的命令:podman quadlet install(为当前用户安装新的 Quadlet)、podman quadlet list(列出已安装的 Quadlet)、podman quadlet print(打印 Quadlet 文件的内容)以及 podman quadlet rm(移除 Quadlet)。目前这些命令在远程 Podman 客户端中不可用——我们预计将在未来版本中添加支持。
  • Quadlet .container 单元现在可以在 Environment= 键中指定不带值的变量,容器启动时从主机获取该值(#26247)。
  • Quadlet .pod 单元现在支持两个新键:Label=(用于设置创建的 Pod 的标签)和 ExitPolicy=(用于设置创建的 Pod 的退出策略)(#25961#25596)。
  • Quadlet .image 单元现在支持一个新键:Policy=,用于设置镜像的拉取策略(例如始终拉取,仅当有更新版本可用时拉取)(#26446)。
  • Quadlet .network 单元现在支持一个新键:InterfaceName=,用于指定创建的网络接口的名称。
  • podman machine init 命令现在支持一个新选项 --swap,可在创建的虚拟机中启用交换空间并设置其大小(以兆字节为单位)(#15980)。
  • podman createpodman run--mount 选项现在支持 dest= 作为 destination= 的有效别名。
  • podman kube play 命令现在可以使用注解 io.podman.annotations.cpuset/$ctrnameio.podman.annotations.memory-nodes/$ctrname 将容器执行限制在特定的 CPU 核心和内存节点上(#26172)。
  • podman kube play 命令现在支持 Pod YAML 中的 lifecycle.stopSignal 字段,允许指定用于停止容器的信号(#25389)。
  • podman volume importpodman volume export 命令现已在远程 Podman 客户端中可用(#26049)。
  • podman build--build-context 选项现已得到远程 Podman 客户端的支持(#23433)。
  • podman volume create 命令现在接受两个新选项:--uid--gid,用于设置创建卷时使用的 UID 和 GID。
  • podman secret create 命令现在有一个新选项 --ignore,该选项使命令即使在已存在同名密钥时也能成功执行。
  • podman pull 命令现在有一个新选项 --policy,用于配置拉取策略。
  • podman createpodman runpodman pod create--mount type=artifact 选项现在允许使用 name= 选项(例如 podman run --mount type=artifact,name=$NAME,...)设置容器内制品文件的名称。
  • podman createpodman run--tmpfs 选项现在允许传递一个新选项 noatime(例如 podman run --tmpfs /run:noatime ...)(#26102)。
  • podman update 命令现在有一个新选项 --latest,用于更新最新的容器,而无需指定特定容器(#26380)。
  • 新增命令 podman buildx inspect 以提高与 Docker 的兼容性(#13014)。

变更

  • 对于在 M3 或更新主机(运行 macOS 15 或更高版本)上使用 libkrun 提供程序运行 podman machine 虚拟机的用户,默认启用嵌套虚拟化。
  • 在 Windows 上使用 WSL v2 提供程序创建 podman machine 虚拟机时,现在从 quay.io/podman/machine-os 以制品形式拉取镜像,与其他虚拟机提供程序的行为保持一致。
  • podman runpodman attach--sig-proxy 选项执行的信号转发现在对竞争条件更加健壮,并且不再转发 SIGSTOP 信号。
  • podman system check --quick 命令现在跳过检查层摘要。
  • Windows 上使用 WSLv2 提供程序的 Podman 现在更倾向于使用 C:\Program Files\Windows Subsystem for Linux\wsl.exe 中的 WSL 可执行文件,而不是 WindowsApps 中的版本,从而避免常见的“拒绝访问”问题(#25787)。
  • podman createpodman runpodman pod create--mount type=artifact 选项现在将仅包含单个 blob 的制品挂载为文件,目标路径在镜像中不存在时适用。
  • podman volume export 命令现在拒绝导出到 TTY 的标准输出(#26506)。
  • 当使用已知与 Podman 结合使用时存在问题的选项(例如单元文件 [Service] 部分中的 User=Group=DynamicUser=)生成 Quadlet 单元时,Quadlet 现在会向用户发出潜在不兼容警告(#26543)。

修复

  • 修复了 podman createpodman run--security-opt unmask= 选项不允许传递逗号分隔路径列表的错误,之前仅允许单个路径。
  • 修复了在容器运行时,如果容器内启动的 exec 会话的 PID 被新进程重用,停止 Podman 容器可能会无意中杀死非 Podman 进程的错误(#25104)。
  • 修复了 podman machine init 如果在 Podman 容器中运行可能会失败的错误(#25950)。
  • 修复了 podman machine 虚拟机有时会收到错误时区信息的错误。
  • 修复了使用自定义用户名创建的 podman machine 虚拟机未启用 lingering 的错误。
  • 修复了在 Windows 上使用 WSL 2 提供程序时,podman machine init 命令无法可靠确定是否已安装 WSL 的错误(#25523)。
  • 修复了未指定 PodName= 键的 Quadlet .pod 单元名称设置错误的错误(#26062)。
  • 修复了 Quadlet .container 单元加入在 .pod 单元中指定的 Pod 时会失败的错误,因为创建容器时 Pod 名称设置不正确(#26105)。
  • 修复了 Quadlet 在将设置了 Type=bind.volume 单元挂载到容器中时不会生成 RequiresMountsFor 的错误(#26125)。
  • 修复了如果两个 dropin 文件不共享父目录,层级结构中更靠后且具有相同名称的新 dropin 文件无法正确覆盖 Quadlet dropin 文件的错误(#26555)。
  • 修复了 Quadlet 有时在解析单元失败时不打印警告的错误(#26542)。
  • 修复了 Quadlet .pod 文件在生成的 systemd 服务中未包含 [Service] 部分最后一个 Environment= 键的错误(#26521)。
  • 修复了启动具有已运行依赖项的容器时会失败的错误。
  • 修复了使用 --hooks-dir 指定目录中的 OCI 挂钩在容器重启时无法运行的错误(#17935)。
  • 修复了 podman createpodman run--mount 选项在未指定 type= 时要求指定而不是默认使用 volume 的错误(#26101)。
  • 修复了在 Windows 上,podman kube play 命令在指定 YAML 文件的绝对路径时会失败的错误(#26350)。
  • 修复了 podman createpodman runpodman pod create--security-opt seccomp= 选项在 Windows 上给定 Seccomp 配置文件路径时可能出错的错误(#26558)。
  • 修复了 podman createpodman run--blkio-weight-device--device-read-bps--device-write-bps--device-read-iops--device-write-iops 选项错误地接受非块设备的错误。
  • 修复了 podman build 命令处理 --ignorefile 选项的方式与 buildah bud 命令不同的错误(#25746)。
  • 修复了 podman rm -f 命令在尝试移除 conmon 进程已被终止的运行容器时可能返回错误的错误(#26640)。
  • 修复了当在 containers.conf 中设置了 log_size_max 时,podman inspect 命令未正确显示容器日志大小的错误。

API

  • 新增了一整套用于与制品交互的 API 端点,包括检查制品(GET /libpod/artifacts/{name}/json)、列出所有制品(GET /libpod/artifacts/json)、拉取制品(POST /libpod/artifacts/pull)、移除制品(DELETE /libpod/artifacts/{name})、从请求正文中的 tar 文件添加制品(或追加到现有制品)(POST /libpod/artifacts/add)、将制品推送到注册表(/libpod/artifacts/{name}/push)以及检索制品内容(GET /libpod/artifacts/{name}/extract)。
  • 容器的兼容性创建端点现在接受新参数 HostConfig.CgroupnsMode,用于指定创建容器的 cgroup 命名空间模式。
  • 容器的兼容性创建端点现在尊重 containers.conf 中的 base_hosts_file 选项。
  • 兼容性信息端点现在返回一个新字段 DefaultAddressPools
  • 修复了兼容性删除容器 API 在 FORCE 参数设置为 true 时会删除运行容器的错误;Docker 仅删除已停止的容器(#25871)。
  • 修复了容器的兼容性列表和兼容性检查端点使用 Podman 状态而不是转换为 Docker 兼容状态来返回容器状态的错误(#17728)。
  • 修复了超过超时时间的健康检查未被正确终止的错误;它们现在会在超时后收到 SIGTERM,然后在延迟后收到 SIGKILL(#26086)。
  • 修复了 application/json 响应会被 HTML 转义,从而修改某些响应的错误(例如镜像历史响应中的 <missing> 变为 \u003cmissing\u003e)(#17769)。

其他

  • Quadlet 在停止容器时不再使用容器/Pod ID 文件,而是将容器/Pod 的名称直接传递给 podman stop/podman pod stop
  • 通过 Makefile 构建 Podman 时,如果本地安装了 sqlite3 库和头文件,现在会尝试动态链接 sqlite3。此项和其他优化应显著减小相对于 Podman 5.5.x 的二进制文件大小。打包者可以在不使用 Makefile 构建时使用 libsqlite3 构建标签来强制此行为。
  • 将 Buildah 更新至 v1.41.0
  • 将 containers/common 库更新至 v0.64.0
  • 将 containers/storage 库更新至 v1.59.0
  • 将 containers/image 库更新至 v5.36.0

更新内容 (原始)

Features

  • A new set of commands for managing Quadlets has been added as podman quadlet install (install a new Quadlet for the current user), podman quadlet list (list installed Quadlets), podman quadlet print (print the contents of a Quadlet file), and podman quadlet rm (remove a Quadlet). These commands are presently not available with the remote Podman client - we expect support for this to arrive in a future release.
  • Quadlet .container units can now specify environment variables without values in the Environment= key, retrieving the value from the host when the container is started (#26247).
  • Quadlet .pod units now support two new keys, Label= (to set labels on the created pod) and ExitPolicy= (to set exit policy for the created pod) (#25961 and #25596).
  • Quadlet .image units now support a new key, Policy=, to set pull policy for the image (e.g. pull always, pull only if newer version available) (#26446).
  • Quadlet .network units now support a new key, InterfaceName=, to specify the name of the network interface created.
  • The podman machine init command now supports a new option, --swap, enabling swap in the created virtual machine and setting it to a given size (in megabytes) (#15980).
  • The --mount option to podman create and podman run now supports dest= as a valid alias for destination=.
  • The podman kube play command can now restrict container execution to specific CPU cores and specific memory nodes using the io.podman.annotations.cpuset/$ctrname and io.podman.annotations.memory-nodes/$ctrname annotations (#26172).
  • The podman kube play command now supports the lifecycle.stopSignal field in Pod YAML, allowing the signal used to stop containers to be specified (#25389).
  • The podman volume import and podman volume export commands are now available in the remote Podman client (#26049).
  • The --build-context option to podman build is now supported by the remote Podman client (#23433).
  • The podman volume create command now accepts two new options, --uid and --gid, to set the UID and GID the volume will be created with.
  • The podman secret create command now has a new option, --ignore, causing the command to succeed even if a secret with the given name already exists.
  • The podman pull command now has a new option, --policy, to configure pull policy.
  • The --mount type=artifact option to podman create, podman run, and podman pod create now allows the filename of the artifact in the container to be set using the name= option (e.g. podman run --mount type=artifact,name=$NAME,...).
  • The --tmpfs option to podman create and podman run now allows a new option, noatime, to be passed (e.g. podman run --tmpfs /run:noatime ...) (#26102).
  • The podman update command now has a new option, --latest, to update the latest container instead of specifying a specific container (#26380).
  • A new command, podman buildx inspect, has been added to improve Docker compatibility (#13014).

Changes

  • For users running podman machine VMs using the libkrun provider on an M3 or newer host running macOS 15+, nested virtualization is enabled by default.
  • When creating podman machine VMs on Windows using the WSL v2 provider, images are now pulled as artifacts from quay.io/podman/machine-os, matching the behavior of other VM providers.
  • Signal forwarding done by the --sig-proxy option to podman run and podman attach is now more robust to races and no longer forwards the SIGSTOP signal.
  • The podman system check --quick command now skips checking layer digests.
  • Podman on Windows using the WSLv2 provider now prefers the WSL executable in C:\Program Files\Windows Subsystem for Linux\wsl.exe over the one in WindowsApps, avoiding common “access denied” issues (#25787).
  • The --mount type=artifact option to podman create, podman run, and podman pod create now mounts artifacts containing a only a single blob as a file at the given destination path if the path does not exist in the image.
  • The podman volume export command now refuses to export to STDOUT if it is a TTY (#26506).
  • When generating Quadlet units with options known to be problematic when used with Podman, such as User=, Group=, and DynamicUser= in the [Service] section of a unit, Quadlet will now warn the user of the potential incompatibility (#26543).

Bugfixes

  • Fixed a bug where the --security-opt unmask= option to podman create and podman run did not allow comma-separated lists of paths to be passed, instead only allowing a single path.
  • Fixed a bug where stopping a Podman container could unintentionally kill non-Podman processes if the PID of an exec session started inside the container was reused for a new process while the container was running (#25104).
  • Fixed a bug where podman machine init could fail if run in a Podman container (#25950).
  • Fixed a bug where podman machine VMs would sometimes receive incorrect timezone information.
  • Fixed a bug where podman machine VMs created with a custom username would not have lingering enabled.
  • Fixed a bug where the podman machine init command on Windows when using the WSL 2 provider did not reliably determine if WSL was installed (#25523).
  • Fixed a bug where the name of Quadlet .pod units that did not specify the PodName= key was set incorrectly (#26062).
  • Fixed a bug where Quadlet .container units joining a pod specified in a .pod unit would fail as the pod name was set incorrectly when creating the container (#26105).
  • Fixed a bug where Quadlet would not generate RequiresMountsFor when mounting a .volume unit with Type=bind set into a container (#26125).
  • Fixed a bug where Quadlet dropin files were not correctly overwritten by new dropin files with the same name further along the hierarchy if the two dropin files did not share a parent directory (#26555).
  • Fixed a bug where Quadlet would sometimes not print warnings when failing to parse units (#26542).
  • Fixed a bug where Quadlet .pod files did not include the last Environment= key in the [Service] section in the generated systemd service (#26521).
  • Fixed a bug where starting a container with already-running dependencies would fail.
  • Fixed a bug where OCI hooks in a directory specified with --hooks-dir would fail to run when containers were restarted (#17935).
  • Fixed a bug where the --mount option to podman create and podman run required the type= option to be specified, instead of defaulting to volume when it was not present (#26101).
  • Fixed a bug where the podman kube play command would fail on Windows when specifying an absolute path to YAML files (#26350).
  • Fixed a bug where the --security-opt seccomp= option to podman create, podman run, and podman pod create could error on Windows when given a path to a Seccomp profile (#26558).
  • Fixed a bug where the --blkio-weight-device, --device-read-bps, --device-write-bps, --device-read-iops, and --device-write-iops options to podman create and podman run incorrectly accepted non-block devices.
  • Fixed a bug where the podman build command handled the --ignorefile option differently from the buildah bud command (#25746).
  • Fixed a bug where the podman rm -f command could return an error when trying to remove a running container whose conmon process had been killed (#26640).
  • Fixed a bug where the podman inspect command did not correctly display log size for containers when log_size_max was set in containers.conf.

API

  • A full set of API endpoints for interacting with artifacts has been added, including inspecting artifacts (GET /libpod/artifacts/{name}/json), listing all artifacts (GET /libpod/artifacts/json), pulling an artifact (POST /libpod/artifacts/pull), removing an artifact (DELETE /libpod/artifacts/{name}), adding an artifact (or appending to an existing artifact) from a tar file in the request body (POST /libpod/artifacts/add), pushing an artifact to a registry (/libpod/artifacts/{name}/push), and retrieving the contents of an artifact (GET /libpod/artifacts/{name}/extract).
  • The Compat Create endpoint for Containers now accepts a new parameter, HostConfig.CgroupnsMode, to specify the cgroup namespace mode of the created container.
  • The Compat Create endpoint for Containers now respects the base_hosts_file option in containers.conf.
  • The Compat Info endpoint now returns a new field, DefaultAddressPools.
  • Fixed a bug where the Compat Delete API for Containers would remove running containers when the FORCE parameter was set to true; Docker only removes stopped containers (#25871).
  • Fixed a bug where the Compat List and Compat Inspect endpoints for Containers returned container status using Podman statuses instead of converting to Docker-compatible statuses (#17728).
  • Fixed a bug where healthchecks that exceeded their timeout were not properly terminated; they now receive SIGTERM, then SIGKILL after a delay, if their timeout is exceeded (#26086).
  • Fixed a bug where application/json responses would be HTML escaped, mutating some responses (e.g. <missing> becoming \u003cmissing\u003e in image history responses) (#17769).

Misc

  • Quadlet now no longer uses container/pod ID files when stopping containers, but instead passes the name of the container/pod directly to podman stop/podman pod stop.
  • When building Podman via Makefile, it will now attempt to dynamically link sqlite3 if the library and header are installed locally. This and other optimizations should result in a significant reduction in binary size relative to Podman 5.5.x. Packagers can use the libsqlite3 build tag to force this behavior when not using the Makefile to build.
  • Updated Buildah to v1.41.0
  • Updated the containers/common library to v0.64.0
  • Updated the containers/storage library to v1.59.0
  • Updated the containers/image library to v5.36.0

下载链接