Podman 6:机器可用性改进
Podman 6: machine usability improvements (2025)

原始链接: https://blog.podman.io/2025/10/podman-6-machine-usability-improvements/

Podman 6 在 CLI 管理虚拟机提供程序(如 WSL、QEMU、libkrun 或 applehv)的方式上进行了重大改进。 在之前的 Podman 5 中,CLI 主要仅识别 `containers.conf` 中设为默认的机器提供程序。这经常导致使用不便,因为通过其他提供程序(例如 Podman Desktop)创建的机器,若没有特定标志,很难通过标准的 Podman CLI 命令进行访问或管理。 Podman 6 转向了与提供程序无关的模式。主要变化包括: * **统一管理:** `stop`、`start` 和 `rm` 等命令现在可以按机器名称无缝跨所有提供程序运行,消除了 Podman 5 中常见的“虚拟机不存在”错误。 * **全局可见性:** `podman machine ls` 命令现在默认显示所有支持的提供程序中的所有机器,不再需要 `--all-providers` 标志。 * **灵活创建:** 用户现在可以在初始化机器时,通过 `podman machine init` 的新 `--provider` 标志直接指定非默认的提供程序。 这些更新简化了用户体验,使得在单一 CLI 工作流中管理各种虚拟化环境变得更加容易。

```Hacker News 最新 | 过往 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 Podman 6:机器可用性改进 (podman.io) 16 分,daesorin 发布于 1 小时前 | 隐藏 | 过往 | 收藏 | 1 条评论 帮助 darcien 15 分钟前 [–] 有人知道为什么分享这个 2025 年的公告吗?看起来像是推迟了且尚未发布? https://blog.podman.io/2026/05/podman-6-release-delayed/ 回复 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:```
相关文章

原文

I wanted to introduce a significant change we are making in Podman 6 for our machine function. To understand the problem and change, we first need to establish that Podman machine is based on a concept of providers.  The provider is a generic term that describes how Podman runs the Linux virtual machine.  The following table is a list of providers by platform.

PlatformSupported Providers
WindowsWSL1
HyperV
LinuxQEMU1
MacOSLibkrun1
Applehv2

1 default for platforms for Podman 6

2 default for Podman 5

In Podman 5, particularly with the use of Podman Desktop and with platforms that supported multiple providers, it was possible to create machines for either provider without changing the default provider as defined in ~/.config/containers/containers.conf.  So if you created or ran a machine in the non-default provider with Podman Desktop and then decided to use the Podman CLI, the CLI would be unaware of the existence of the machine. This is because Podman was only aware of machines and the existence of machines within the confines of its default provider–with one or two minor exceptions. Consider the following:

$ podman -v
podman version 5.7.0-dev

In Podman 5, the default provider per platform was hardcoded in the Podman binary.  It could be overridden in containers.conf. This indicates that we are setting libkrun as the default machine provider.

$ cat ~/.config/containers/containers.conf
[machine]
provider="libkrun"

Now suppose in Podman Desktop or via other means, we created a machine and we know it is running.  To get a global view of all machines in Podman 5, you could use the --all-providers command line switch with podman machine ls.

$ podman machine ls —all-providers

NAME                     VM TYPE     CREATED         LAST UP            CPUS        MEMORY      DISK SIZE
applehv-machine-1        applehv     8 minutes ago   Currently running  6           2GiB        100GiB
podman-machine-default*  libkrun     26 minutes ago  8 minutes ago      6           2GiB        100GiB

However, using the Podman 5 CLI, when attempting to stop the machine by name we see an error like the following:

$ podman machine stop applehv-machine-1
Error: applehv-machine-1: VM does not exist

In Podman 6, we have made an overt push to make the prominence of the machine provider less prevalent.  For commands like rm, stop, start (and others), we want users to be able to simply provide the machine name and regardless of the provider, Podman will act.  And now that our upstream main branch has switched over to Podman 6 development, I have begun to already alter this base function.

$ podman -v
podman version 6.0.0-dev

And now with Podman 6.

$ podman machine stop applehv-machine-1
Machine "applehv-machine-1" stopped successfully

Also note, I have removed --all-providers from the machine command but the default behavior is now to show all machines across all supported providers.

$ podman machine ls
NAME                     VM TYPE     CREATED         LAST UP         CPUS        MEMORY      DISK SIZE
applehv-machine-1        applehv     8 minutes ago   15 seconds ago  6           2GiB        100GiB
podman-machine-default*  libkrun     27 minutes ago  9 minutes ago   6           2GiB        100GiB

The second advancement in this work is around the creation of machines.  This is done with the podman machine init command.  You can now create a machine in a non-default provider with the new --provider command line switch.  Consider this case where libkrun is the default provider, but I want to create a new machine that uses the applehv provider.

$ podman machine init --now --provider applehv applehv-machine-2
Looking up Podman Machine image at quay.io/podman/machine-os:6.0 to create VM
Extracting compressed file: applehv-machine-2-arm64.raw: done
Machine init complete
Starting machine "applehv-machine-2"
… <omited for brevity>
Machine "applehv-machine-2" started successfully

A quick machine ls confirms the new machine was created with the correct provider.

$ podman machine ls
NAME                     VM TYPE     CREATED         LAST UP             CPUS        MEMORY      DISK SIZE
applehv-machine-2        applehv     56 seconds ago  Currently running   6           2GiB        100GiB
applehv-machine-1        applehv     10 minutes ago  About a minute ago  6           2GiB        100GiB
podman-machine-default*  libkrun     28 minutes ago  10 minutes ago      6           2GiB        100GiB

If you are interested in the happenings and development of Podman 6, our upstream repository is the best place to get information.  And we are always looking for people with all kinds of skills to help our project.  There are many ways to contribute beyond coding.

联系我们 contact @ memedata.com