Commit Graph

7340 Commits

Author SHA1 Message Date
Paul Holzinger
a7ed92280a Merge pull request #28569 from mheon/60_migrate
Podman 6: Automatic BoltDB to SQLite migration
2026-05-08 21:36:52 +02:00
Matt Heon
d420fbfde3 Add migration code for BoltDB to SQLite
This is gated behind a new option in `podman system migrate`,
`--migrate-db`, or by a system restart being performed.

BoltDB support was removed in Podman 6, so we are certain that,
when we start Podman, a SQLite state is in use. However, if we
also detect a valid BoltDB state, we will attempt a migration.

Migration is performed by retrieving all volumes, pods, and
containers (in that order, to ensure there are no dependency
conflicts) from the Bolt database, when adding them to the SQLite
database. If there is a conflict - IE, a container exists in both
SQLite and Bolt - we skip migration for that object. The old DB
is then renamed so we do not try to migrate it again.

Our ability to test complex migration scenarios is limited, but
this should handle simple migrations easily.

This is a heavily adapted version of #27660 rebuilt to work with
Podman 6.0. Substantial changes were required to throw errors
when a BoltDB database is detected and no migration is being
performed. Firstly, for automatic on-reboot migrations, we need
to have a deferred error returned by getDBState (very early in
runtime initialization) that is only acted on much later (once we
know for certain a state refresh is/is not being performed).
The `system migrate --migrate-db` command was much more
problematic. Conceptually, it's not terrible - add a flag to the
runtime to suppress errors, set that flag only when calling the
`system migrate` command with `--migrate-db` - but it unveiled a
serious problem with how we do runtime init (special flags to the
runtime were being ignored because the image runtime set the
Libpod runtime first and had none of the proper handling) which
took a genuinely annoying amount of time to identify and fix.

This cannot be tested automatically, as the ability to create Bolt
databases has been entirely removed with Podman 6.

This also includes 9b810aed3a from
the v5.8 branch by Luap99, which I have had to squash into this
commit to satisfy the build-each-commit check. It was just a
simplification of the SQLite path check.

Signed-off-by: Matt Heon <matthew.heon@pm.me>
2026-05-08 14:07:17 -04:00
Ashley Cui
462b24479b Use tmp context dir when building with process substitution
Podman defaults to the directory of the Containerfile when no context dir is explicitly provided.
When running podman build with process subsituiton,  `podman build -f <(echo "FROM scratch")`,
the Containerfile path expands to `/dev/fd/<NUM>`, which makes `/dev/fd` the context dir.
When building, Buildah attempts to create an overlay mount on top of the `/dev/fd` context dir, which fails.

In these cases, use a temp context dir instead: `$TMPDIR/podman-build-context-$randnum`

Fixes: https://github.com/containers/podman/issues/28113

Signed-off-by: Ashley Cui <acui@redhat.com>
2026-05-08 10:39:38 -04:00
Lokesh Mandvekar
89efbf1dce pkg/api/grpcpb: auto-format generated protobuf files
Update build.sh to run gofumpt on generated .pb.go files, and apply
formatting to existing generated files. This fixes gofumpt and inamedparam
lint errors on macOS CI and ensures future regenerations will be
automatically formatted.

Signed-off-by: Lokesh Mandvekar <lsm5@linux.com>
2026-05-07 13:30:23 -04:00
Paul Holzinger
d54f1eb6fe machine/wsl: remove some dead code
The config.go file has a build tag that was never used. Also remove
unused functions from other files.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-05-07 13:34:06 +02:00
Giuseppe Scrivano
d8df5c37ef specgen: memoize isMqueueSupported with sync.OnceValue
Avoid reading /proc/filesystems on every container creation when
running as a service by caching the result.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2026-05-05 14:41:26 +02:00
Paul Holzinger
8c9f530cb3 Merge pull request #28621 from l0rd/import-certs-darwin-linux
Import host trusted certificates into the guest machine - macOS and Linux
2026-05-05 13:10:57 +02:00
Paul Holzinger
e3a48902f7 Merge pull request #28639 from giuseppe/skip-dev-mqueue-if-not-present
specgen: skip /dev/mqueue mount if not available
2026-05-05 12:13:26 +02:00
Giuseppe Scrivano
1bda61b840 specgen: skip /dev/mqueue mount if not supported by the kernel
check /proc/filesystems to determine if the kernel supports the mqueue
filesystem.  If it doesn't, skip the /dev/mqueue mount in the
container.  This can happen with the libkrunfw kernel that does not
have support for mqueue.

Closes: https://github.com/containers/crun/issues/2080
Closes: https://github.com/containers/libkrun/issues/653

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2026-05-04 20:03:55 +02:00
Jan Rodák
d5b4685cc8 Fix lint issue with replace reflect.Ptr with reflect.Pointer
Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-05-04 13:48:36 +02:00
Mario Loriedo
3f883706ba Import local certificates to machines on macOS and Linux
This is a follow up of https://github.com/containers/podman/pull/28336 where we
implemented the import of the certificates on Windows. This PR implements the
same feature on macOS and Linux.

Fixes https://redhat.atlassian.net/browse/RUN-4552

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2026-05-01 00:42:52 +02:00
Matt Heon
99b2fe252e Merge pull request #28455 from simonbrauner/fix-filtering-with-negated-labels
Fix filtering with negated labels
2026-04-30 12:08:31 -04:00
Mario Loriedo
15c9ca130f Add command podman system hyperv-prep
Introducing a new `podmand system` subcommand to prepare a Windows host
to run Hyper-V based Podman machines: `hyperv-prep`.

When executed it:
- creates of the registry keys for VSocks
- adds the current user to the Hyper-V administrators group

This command requires an administrator terminal.

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2026-04-29 23:00:29 +02:00
Mario Loriedo
92d186f20d Hyperv machine init/rm: skip win registry operations when possible
Hyper-V VMs require some specific Windows registry keys to allow the
communication between the host and the guest. Creating these registry
keys require elevated privileges.

These keys were created during the first Podman `machine init` and
removed when the last Podman machine is removed.

In this commit we skip the creation of the keys if they already exist in
the registry. So that admin privileges aren't required anymore, even for
the creation of the first Podman machine.

In other words, if the keys are pre-created by an administrator, user
will be able to create and remove machines without requiring to run any
elevated command. Even for the first podman machine.

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2026-04-29 23:00:29 +02:00
Mario Loriedo
f6b6bce745 Minor hyperv stubber.go and vsock.go refactoring
Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2026-04-29 23:00:29 +02:00
Šimon Brauner
fdd8cc17fa Fix filtering with negated labels
Signed-off-by: Šimon Brauner <sbrauner@redhat.com>
2026-04-29 11:18:03 +02:00
jait jacob
efc6ddfcc4 cleanup: run go fix on pkg/machine for windows
Signed-off-by: jait jacob <jai8.jacob@gmail.com>
2026-04-29 13:56:01 +05:30
Lokesh Mandvekar
9b253ab347 Update stale comments referencing slirp4netns
Replace remaining references to Slirp/slirp4netns in code comments
with Pasta or remove them where the reference is no longer relevant.

Signed-off-by: Lokesh Mandvekar <lsm5@linux.com>
2026-04-27 10:22:26 -04:00
Matt Heon
cc2e2c94b8 Merge pull request #27929 from kairosci/fix/27786-health-field-containers-json
compat: Add Health field to /containers/json endpoint
2026-04-23 11:39:08 -04:00
Alessio Attilio
c4a4c7e117 API: Add Health field to compat ListContainers and restrict to v1.52+
Signed-off-by: Alessio Attilio <attilio.alessio@protonmail.com>
2026-04-23 08:39:43 +00:00
Nabil Houidi
d44655537e fix: ensure infra image is set from infra container spec in PodConfigToSpec
fixes #21609

Signed-off-by: Nabil Houidi <35373676+NabilHouidi@users.noreply.github.com>
2026-04-22 23:47:00 +02:00
Brent Baude
2cc3be7332 RUN-4539: Change podman module paths
The podman module paths are moving from github.com/containers/podman to
go.podman.io/podman.  This will help with future mobility.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2026-04-22 14:02:25 -05:00
Matt Heon
3279767614 Merge pull request #28336 from l0rd/import_native_ca
Import host trusted certificates into the guest machine - Windows part
2026-04-22 13:04:55 -04:00
Brent Baude
9ac300c6af Merge pull request #28535 from lstocchi/i25037
auto-add user to Hyper-V Administrators group
2026-04-22 10:31:55 -05:00
lstocchi
57eeb47143 auto-add user to Hyper-V Administrators group
Currently, running Podman on Hyper-V as a non-administrator requires the user to be a member of the "Hyper-V Administrators" local group. If they are not, various WMI calls fail with access denied.

This commit automates the permission setup.
1. During podman machine init, if Podman is running with elevated privileges (required for registry/networking setup anyway), it will now automatically add the current user to the localized "Hyper-V Administrators" group
2. If a user is added to the group, the change is not reflected until the next login. We now detect this state and explicitly instruct the user to log out and back in.
3. Modified the Hyper-V stubber to handle permission checks at the method level rather than the provider selection level (GetAll). This allows init to continue far enough to perform the elevation and setting.

Signed-off-by: lstocchi <lstocchi@redhat.com>
2026-04-22 11:03:37 +02:00
Brent Baude
2e6f29a2df RUN-4538: Fix buildah vendoring
This PR reflects the upstream change of moving the buildah module from
github.com/containers/buildah to go.podman.io/buildah.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2026-04-21 14:27:58 -05:00
Paul Holzinger
ff6fb6eb2d Merge pull request #28508 from jankaluza/configfile
trust: switch policy.json lookup to configfile
2026-04-21 12:04:43 +02:00
Matt Heon
98ca040cd7 Merge pull request #28536 from zhangguanzhang/fix-tmp
Clean up temporary file for CreateImageFromSrc
2026-04-20 18:19:20 -04:00
Jan Kaluza
cae4c40323 compat: limit err scope in CommitContainer.
Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2026-04-20 15:11:34 +02:00
Jan Kaluza
03afb7403d trust: fail on policy path resolution errors, remove fallback logic
Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2026-04-20 15:11:34 +02:00
Jan Kaluza
54d61c2f02 trust: switch policy.json lookup to configfile
Use shared configfile instead of custom policy.json path handling.
This updates ocipull to rely on signature.DefaultPolicy(), removes
explicit SignaturePolicyPath, and replaces trust's custom default-policy
path logic with common configfile code.

Replace hidden `--policypath` with --signature-policy` and require
it for `trust set` command instead of path resolution based on
configfile.

For `trust get`, the `--signature-policy` is optional.

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2026-04-20 15:11:22 +02:00
Jan Rodák
ecf493dea0 Fix Docker compat /wait hanging on fast-exiting containers
The Docker client (docker run) sends /wait then /start, but it only
sends /start after receiving the 200 OK response from /wait. Previously,
the event subscription for the "died" event was set up after the 200 was
sent, creating a window where a fast-exiting container (e.g. hello-world)
could emit its "died" event before the subscription was ready, causing
the client to hang forever.

Fix this by subscribing to "died" events before flushing the 200 status
code. This guarantees the event listener is ready before the client can
send /start, eliminating the race entirely.

Fixes: https://github.com/containers/podman/issues/28514

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-04-20 15:01:42 +02:00
Paul Holzinger
34a4633d5f Merge pull request #28275 from mheon/ordered_networks
Move to deterministic network setup order
2026-04-20 12:33:13 +02:00
Jan Rodák
7534429ade Merge pull request #28524 from Luap99/isolate
remove isolate option from docker compat API
2026-04-20 10:03:27 +02:00
Jan Rodák
2fd0d2636c Merge pull request #28528 from inknos/pod-option-quadlet
Add Pod to quadlet list
2026-04-20 10:02:03 +02:00
zhangguanzhang
64f9059d2e Fixes: #28531 Clean up temporary file for CreateImageFromSrc
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2026-04-18 19:38:37 +08:00
Matthew Heon
efba9996f6 Implement --save-stages/--stage-labels for build
These are two new Buildah flags that we need to wire into Podman
(both local and remote) and document, with the interesting note
that one requires the other and a check needed to be added for
that.

Also: secret parsing was tightened up in Buildah, and was
breaking the remote build tests. Rewire it to use the new parser
Buildah made, which ends up simplifying the code considerably.
Tests are back to passing afterwards.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2026-04-17 10:00:32 -04:00
Matthew Heon
5e94c95ad0 Move to deterministic network setup order
This was implemented by containers/netavark #1369; this commit
completes the process by wiring it into Podman. We now respect
the CLI order for configured networks - if a user passes
`--net net1,net2` we guarantee that net1 will be configured
before net2.

For containers created before this patch, we don't retain enough
information to configure networks in CLI order, so we use
alphabetical order instead to still guarantee consistency.

No breaking API changes have been made, but we do add a new
field to supplement the existing map to (optionally) provide
ordering information. The Podman CLI will always pass this.
Existing applications that do not will, again, receive]
deterministic ordering based on an alphabetical sort of network
names.

This requires the latest version of Netavark to work properly.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2026-04-17 10:00:32 -04:00
Nicola Sella
d92cc360f1 Add Pod to quadlet list
Fixes: https://redhat.atlassian.net/browse/RUN-3835

Signed-off-by: Nicola Sella <nsella@redhat.com>
2026-04-17 13:42:16 +02:00
Donal O'Sullivan
f15b8e1b2b Sort cliOpts fields alphabetically in Compat Create
Improve code readability by sorting ContainerCreateOptions field
assignments alphabetically and simplifying access to embedded
Config fields.
Fixes: #28377

Signed-off-by: Donal O'Sullivan <donal.osullivan@elastic.co>
2026-04-16 16:38:26 +01:00
Paul Holzinger
41b785af5e remove isolate option from docker compat API
With netavark v2 we start to default to strict isolation mode in
netavark[1] as such that already matches the docker behavior.

Therefore no longer hard code the isolate option in the compat api.

Podman v6 is requires netavark v2 for other changes already so we do
not need to worry about podman 6 + older netavark here.

[1] https://github.com/containers/netavark/pull/1438

Fixes: #27349

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-04-16 15:56:44 +02:00
Mario Loriedo
f7dd6156d3 Import host certificates at machine startup on Windows
Implements the feature introduced in the design
document added with commit 4bdc1d37

Fixes https://redhat.atlassian.net/browse/RUN-4260

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2026-04-16 13:35:40 +02:00
Paul Holzinger
e4776a2dc6 Merge pull request #28498 from Honny1/hc-transient-store
Fix healthcheck failing silently with `--transient-store`
2026-04-15 19:13:19 +02:00
Paul Holzinger
ea4a7f9b65 Merge pull request #28454 from aadi58002/main
fix(#28429): OCIRuntime field in SpecGenerator is ignored when called through HTTP Rest API
2026-04-15 14:33:24 +02:00
Matt Heon
e5f484964a Merge pull request #28495 from Honny1/fix-device-compat-api
Fix Docker API DeviceMapping for CDI devices
2026-04-14 08:42:26 -04:00
Jan Rodák
9598b30ac2 Fix healthcheck failing silently with --transient-store
The systemd timer created for health checks did not pass global
podman flags to the subprocess, causing it to use default storage
settings instead of matching the parent process. This is most
visible with --transient-store, where the healthcheck looks up
the container in the default store instead of the volatile one.

Extract GlobalPodmanArgs() from CreateExitCommandArgs so both the
exit command and healthcheck timer share the same set of global
flags (--root, --runroot, --transient-store, --storage-driver, etc.).

Fixes: https://github.com/containers/podman/issues/28483

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-04-14 14:13:20 +02:00
aadi58002
698c483b7c fix: Ensure OCIRuntime Field is not ignored with HTTP Rest Api (#28454)
Signed-off-by: aadi58002 <aadi58002@gmail.com>
2026-04-14 13:48:11 +05:30
Ygal Blum
8059539425 Quadlet - Support empty source for Mount key
Fixes: #28497

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2026-04-13 17:28:33 -04:00
Jan Rodák
f374f2c95b Fix Docker API DeviceMapping for CDI devices
Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-04-13 20:56:37 +02:00
Paul Holzinger
05ff49a103 Merge pull request #27828 from lsm5/podman6-no-slirp-new
Podman6: Remove slirp
2026-04-13 19:24:28 +02:00