发布日期: 2025-05-14
版本号: v5.5.0

Podman 发布了新版本,主要更新包括:新增 podman machine cppodman artifact extract 命令,支持将 OCI 工件作为新挂载类型(artifact)挂载到容器中,并增强了工件管理功能(如 --append--file-type--all 选项);引入 command 过滤器用于容器操作,以及 --cidfile 选项用于 podman exec;新增与 PID 限制相关的 Kubernetes 注解支持;Quadlet 单元文件新增多个配置项(如 Memory=RetryHostName= 等);优化了健康检查性能并新增 stopped 状态;Pod 内容器现在按依赖顺序停止;Windows 安装程序不再自动安装 WSLv2/Hyper-V。破坏性变更主要涉及 Go API 绑定中容器提交和执行创建接口的结构调整。修复了多项错误,包括健康检查在容器暂停时仍运行、Windows 远程客户端挂载问题、podman exec 用户组处理错误、podman kube generate 生成卷挂载 YAML 不正确等。同时更新了 Buildah、containers-common 等依赖库版本。

更新内容 (中文)

功能特性

  • 新增 podman machine cp 命令,用于将文件复制到运行中的 podman machine 虚拟机中。
  • 新增 podman artifact extract 命令,用于将 OCI 制品的部分或全部内容复制到磁盘上的指定位置。
  • podman createpodman runpodman pod create--mount 选项现在支持新的挂载类型 --mount type=artifact,用于将 OCI 制品挂载到容器中。
  • podman artifact add 命令新增两个选项:--append(将新文件添加到现有制品)和 --file-type(指定添加到制品的文件的 MIME 类型)(#25884)。
  • podman artifact rm 命令新增 --all 选项,用于移除本地存储中的所有制品。
  • podman pausepodman pspodman restartpodman rmpodman startpodman stoppodman unpause--filter 选项现在支持新的过滤器 command,可根据容器中运行命令的第一个元素(argv[0])进行过滤。
  • podman exec 命令新增 --cidfile 选项,可通过文件指定要执行命令的容器 ID(#21256)。
  • podman kube generatepodman kube play 命令现在支持新的注解 io.podman.annotation.pids-limit/$containername,可在 kube generatekube play 之间保留容器的 PID 限制(#24418)。
  • Quadlet .container 单元现在支持三个新键:Memory=(设置创建容器的最大内存)、ReloadCmd(通过 systemd ExecReload 执行命令)和 ReloadSignal(通过 systemd ExecReload 使用给定信号终止容器)(#22036)。
  • Quadlet .container.image.build 单元现在支持两个新键:Retry(拉取镜像失败时的重试次数)和 RetryDelay(重试之间的延迟)(#25109)。
  • Quadlet .pod 单元现在支持新键 HostName=,用于设置 Pod 的主机名(#25639)。
  • Quadlet 文件现在支持在 Install 部分使用新选项 UpheldBy,对应 systemd 的 Upholds 选项。
  • 作为 systemd 依赖项指定的 Quadlet 单元名称现在会自动转换,例如 Wants=my.container 现在有效。
  • Podman 现在会为创建和移除密钥生成事件(#24030)。
  • Podman 新增全局选项 --cdi-spec-dir,用于向 CDI 加载器指定 CDI 规范的附加搜索路径(#18292#25691)。
  • podman build 命令新增 --inherit-labels 选项(默认为 true),用于控制是否从基础镜像或基础阶段继承标签。
  • podman update 命令新增 --env--unsetenv 两个选项,用于修改现有容器的环境变量(#24875)。

重要变更

  • 由于 Docker API 类型的变更,REST API 的 Go 绑定中进行了两个小的破坏性更改。containers.Commit() 函数现在返回一个新结构体(types.IDResponse),内容相同;containers.ExecCreate 函数的 handlers.ExecCreateConfig 参数现在包含不同的嵌入式结构体,可能需要更改其赋值方式。

变更

  • Podman 现在需要至少 Go 1.23 才能构建。
  • 健康检查经过重构,以尽量减少对数据库的写入,从而大幅提高系统上同时运行大量健康检查时的性能。
  • 健康检查现在有一个新状态 stopped,如果运行健康检查的容器在检查完成前停止,则报告该状态(#25276)。
  • Pod 中的容器现在根据其依赖关系按顺序停止,infrastructure 容器最后停止,防止应用容器因 infrastructure 容器提前停止而在停止前丢失网络。
  • 由于处理自动安装方面的挑战,Windows 安装程序不再安装 WSLv2 或 Hyper-V。
  • Quadlet 现在会在跳过行时打印警告,以帮助识别格式错误的 Quadlet 文件(#25339)。
  • 不再允许创建将主机挂载到虚拟机的 /tmp 目录的 podman machine 虚拟机(#18230)。
  • podman logs 命令现在允许在容器名称后指定选项(例如 podman logs $containername --follow)(#25653)。
  • Podman 默认不再为 Pod infrastructure 和服务容器使用暂停镜像,而是使用仅包含 catatonit 二进制文件的根文件系统(#23292)。
  • podman system reset 命令不再移除用户的 podman.sock API 套接字。
  • 使用 Netavark v1.15 或更高版本时,非默认网络中的容器将不再添加默认搜索域 dns.podman。解析此类名称的查询仍然有效。
  • 停止 Quadlet .network 单元现在会删除网络(如果没有容器正在使用它)(#23678)。
  • 出于安全加固考虑,容器中默认屏蔽 /proc/interrupts/sys/devices/system/cpu/$CPU/thermal_throttle 路径(#25634)。

错误修复

  • 修复了容器暂停时健康检查仍会运行的问题(#24590)。
  • 修复了 Windows 上的远程 Podman 客户端无法将单字符名称的命名卷挂载到容器中的问题(#25218)。
  • 修复了在没有 CAP_SYS_ADMIN 的情况下运行时,挂载镜像可能导致 panic 的问题(#25241)。
  • 修复了 Podman 在设置健康检查时不会报告错误的问题(#25034)。
  • 修复了 podman exec 命令在未使用 --user 选项显式添加用户时,不会添加执行会话所用用户的附加组的问题(#25610)。
  • 修复了 podman network connectpodman network disconnect 命令期间的错误可能导致数据库错误,从而使 podman inspect 对容器失败的问题。
  • 修复了 podman kube generate 命令未正确生成使用子路径的卷挂载的 YAML 的问题。
  • 修复了 podman system df 命令可能显示负的可回收大小的问题。
  • 修复了使用 podman machine ssh 命令访问非 podman-machine-default(默认虚拟机)的 rootful podman machine 虚拟机时,用户会进入无根 shell 的问题(#25332)。
  • 修复了 podman machine init 在尝试创建内存超过系统内存的机器时,错误消息中报告无意义内存值的问题。
  • 修复了远程 Podman 客户端的 podman start --attach 命令在使用 --rm 选项创建的容器上运行时错误地打印错误的问题(#25965)。
  • 修复了远程 Podman 客户端的 podman pull 命令在服务器意外停止或拉取期间遇到错误时可能挂起并泄漏内存的问题。
  • 修复了远程 Podman 客户端的 podman cp 命令在 Windows 上由于 Windows 路径处理不当经常无法将文件复制到容器中的问题(#14862)。
  • 修复了 podman container clone 命令未正确将健康检查设置复制到新容器的问题(#21630)。
  • 修复了 podman kube play 命令无法启动空 Pod 的问题(#25786)。
  • 修复了 podman volume ls 命令在不存在卷时未输出标题的问题(#25911)。
  • 修复了容器镜像提供的健康检查配置无法覆盖的问题,除非在创建容器时指定了 --health-cmd 选项(#20212)。
  • 修复了 podman createpodman run--user 选项无法与通过 --hostuser 选项添加到容器中的用户一起使用的问题(#25805)。
  • 修复了 FreeBSD 上 podman system reset 命令错误打印错误的问题。
  • 修复了使用 SIGINT 停止 podman machine start 命令可能导致机器状态被错误设置为 “Starting” 的问题(#24416)。
  • 修复了 podman machine start 命令在使用 HyperV 机器提供程序启动包含空格卷的挂载的虚拟机时失败的问题(#25500)。

API

  • 修复了当 Podman 以无根方式运行时,容器的 Compat Create API 忽略请求中指定的 ulimits 的问题(#25881)。

其他

  • REST API 的 Go 绑定中 ExecStartAndAttach() 函数的错误报告已被静默处理,该函数在执行会话停止后 stdin 被消耗时会错误报告错误(#25344)。
  • 更新 Buildah 至 v1.40.0
  • 更新 containers/common 库至 v0.63.0
  • 更新 containers/image 库至 v5.35.0
  • 更新 containers/storage 库至 v1.58.0

更新内容 (原始)

Features

  • A new command has been added, podman machine cp, to copy files into a running podman machine VM.
  • A new command has been added, podman artifact extract, to copy some or all of the contents of an OCI artifact to a location on disk.
  • The --mount option to podman create, podman run, and podman pod create now supports a new mount type, --mount type=artifact, to mount OCI artifacts into containers.
  • The podman artifact add command now features two new options, --append (to add new files to an existing artifact) and --file-type (to specify the MIME type of the file added to the artifact) (#25884).
  • The podman artifact rm command now features a new option, --all, to remove all artifacts in the local store.
  • The --filter option to podman pause, podman ps, podman restart, podman rm, podman start, podman stop, and podman unpause now accepts a new filter, command, which filters on the first element (argv[0]) of the command run in the container.
  • The podman exec command now supports a new option, --cidfile, to specify the ID of the container to exec into via a file (#21256).
  • The podman kube generate and podman kube play commands now supports a new annotation, io.podman.annotation.pids-limit/$containername, preserving the PID limit for containers across kube generate and kube play (#24418).
  • Quadlet .container units now support three new keys, Memory= (set maximum memory for the created container), ReloadCmd (execute a command via systemd ExecReload), and ReloadSignal (kill the container with the given signal via systemd ExecReload) (#22036).
  • Quadlet .container, .image, and .build units now support two new keys, Retry (number of times to retry pulling image on failure) and RetryDelay (delay between retries) (#25109).
  • Quadlet .pod units now support a new key, HostName=, to set the pod’s hostname (#25639).
  • Quadlet files now support a new option, UpheldBy, in the Install section, corresponding to the systemd Upholds option.
  • The names of Quadlet units specified as systemd dependencies are now automatically translated - e.g. Wants=my.container is now valid.
  • Podman now generates events for the creation and removal of secrets (#24030).
  • A new global option has been added to Podman, --cdi-spec-dir, to specify additional search paths for CDI specs to the CDI loader (#18292 and #25691).
  • The podman build command now supports a new option, --inherit-labels (defaults to true), which controls whether labels are inherited from the base image or base stages.
  • The podman update command now supports two new options, --env and --unsetenv, to alter the environment variables of existing containers (#24875).

Breaking Changes

  • Due to changes in Docker API types, two small breaking changes have been made in the Go bindings for the REST API. The containers.Commit() function now returns a new struct (types.IDResponse) with identical contents, and the containers.ExecCreate function’s handlers.ExecCreateConfig parameter now contains a different embedded struct, potentially requiring changes to how it is assigned to.

Changes

  • Podman now requires at least Go 1.23 to build.
  • Healthchecks have been refactored to avoid writing to the database as much as possible, greatly improving performance on systems with many simultaneous healthchecks running.
  • Healthchecks now have a new status, stopped, which is reported if the container the healthcheck was run on stopped before the check could be completed (#25276).
  • Containers in pods are now stopped in order based on their dependencies, with the infra container being stopped last, preventing application containers from losing networking before they are stopped due to the infra container stopping prematurely.
  • Due to challenges with handling automatic installation, the Windows installer no longer installs WSLv2 or Hyper-V.
  • Quadlet will now print warnings when skipping lines to help identify malformed Quadlet files (#25339).
  • Creating podman machine VMs with a host mount over the VM’s /tmp directory is no longer allowed (#18230).
  • The podman logs command now allows options to be specified after the container name (e.g. podman logs $containername --follow) (#25653).
  • Podman, by default, no longer uses a pause image for pod infra and service containers. Instead, a root filesystem containing only the catatonit binary will be used (#23292).
  • The podman system reset command no longer removes the user’s podman.sock API socket.
  • When using Netavark v1.15 and higher, containers in non-default networks will no longer have the default search domain dns.podman added. Queries resolving such names will still work.
  • Stopping a Quadlet .network unit will now delete the network (if no containers are actively using it) (#23678).
  • For security hardening, the /proc/interrupts and /sys/devices/system/cpu/$CPU/thermal_throttle paths are now masked by default in containers (#25634).

Bugfixes

  • Fixed a bug where healthchecks would still run while a container was paused (#24590).
  • Fixed a bug where the remote Podman client on Windows could not mount named volumes with a single-character name into containers (#25218).
  • Fixed a bug where mounting an image could panic when run without CAP_SYS_ADMIN (#25241).
  • Fixed a bug where Podman would not report errors when setting up healthchecks (#25034).
  • Fixed a bug where the podman exec command would not add the additional groups of the user the exec session was run as unless the user was explicitly added with the --user option (#25610).
  • Fixed a bug where errors during the podman network connect and podman network disconnect commands could create errors in the database which would cause podman inspect on the container to fail.
  • Fixed a bug where the podman kube generate command did not correctly generate YAML for volume mounts using a subpath.
  • Fixed a bug where the podman system df command could show a negative reclaimable size.
  • Fixed a bug where accessing a rootful podman machine VM that was not podman-machine-default (the default VM) with the podman machine ssh command would put the user into the rootless shell (#25332).
  • Fixed a bug where the podman machine init would report nonsensical memory values in error messages when trying to create a machine with more memory than the system.
  • Fixed a bug where the remote Podman client’s podman start --attach command would incorrectly print an error when run on a container created with the --rm option (#25965).
  • Fixed a bug where the remote Podman client’s podman pull command could hang and leak memory if the server was unexpectedly stopped or encountered an error during a pull.
  • Fixed a bug where the remote Podman client’s podman cp command would, on Windows, often fail to copy files into the container due to improper handling of Windows paths (#14862).
  • Fixed a bug where the podman container clone command did not correctly copy healthcheck settings to the new container (#21630).
  • Fixed a bug where the podman kube play command would fail to start empty pods (#25786).
  • Fixed a bug where the podman volume ls command did not output headers when no volumes were present (#25911).
  • Fixed a bug where healthcheck configuration provided by a container’s image could not be overridden unless the --health-cmd option was specified when creating the container (#20212).
  • Fixed a bug where the --user option to podman create and podman run could not be used with users added to the container by the --hostuser option (#25805).
  • Fixed a bug where the podman system reset command on FreeBSD would incorrectly print an error.
  • Fixed a bug where stopping the podman machine start command with SIGINT could result in machine state being incorrectly set to “Starting” (#24416).
  • Fixed a bug where the podman machine start command would fail when starting a VM with volume mounts containing spaces using the HyperV machine provider (#25500).

API

  • Fixed a bug where the Compat Create API for Containers ignored ulimits specified in the request when Podman was run rootless (#25881).

Misc

  • Erroneous errors from the ExecStartAndAttach() function in the Go bindings for the REST API have been silenced, where the function would incorrectly report errors when stdin was consumed after the exec session was stopped (#25344).
  • Updated Buildah to v1.40.0
  • Updated the containers/common library to v0.63.0
  • Updated the containers/image library to v5.35.0
  • Updated the containers/storage library to v1.58.0

下载链接