Commit Graph

7379 Commits

Author SHA1 Message Date
Brent Baude
e581ddc253 Merge pull request #28731 from lstocchi/hyperv_enhancements
Fixes for Hyper-V user experience
2026-05-26 10:30:18 -05:00
Paul Holzinger
22c5f3fa55 Merge pull request #28527 from vyasgun/pr/krunkit-timesync
machine: add vfkit timesync device for Apple VMs
2026-05-26 12:23:04 +02:00
Paul Holzinger
1c6d8a0a89 Merge pull request #28759 from kolyshkin/modernize-3
Assorted go modernize fixes
2026-05-26 12:20:31 +02:00
Jan Rodák
5b98ee331f Merge pull request #28641 from jiwahn/feat/container-annotation-filter
Feat/container annotation filter
2026-05-26 12:00:40 +02:00
Jan Rodák
751f7c316d Merge pull request #28714 from christopherbii/main
Fix Missing HostConfig field from API response
2026-05-26 10:26:46 +02:00
lstocchi
f96cbda1b0 hyperv: propagate detailed error from Hyper-V permission checks
Change isHyperVAdminMember from returning a bool to returning an error so that callers surface the specific failure reason — particularly distinguishing "not in the group" from "in the group but session not updated" (new ErrHypervUserSessionNotUpdated sentinel). This gives users actionable guidance instead of a generic permission error.

Signed-off-by: lstocchi <lstocchi@redhat.com>
2026-05-25 00:10:18 +02:00
Kir Kolyshkin
d4f60b5826 libpod: some modernize fixes for freebsd and darwin
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-05-22 14:15:49 -07:00
Kir Kolyshkin
bf78f80b00 Replace strings.Split(..)[0] with strings.Cut
These places were ignored by modernize, so I did some grepping and
editing.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-05-22 13:08:56 -07:00
Kir Kolyshkin
b4d0747baa pkg/systemd/parser: use slices.Backward
Suggested by modernize (aka go fix).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-05-22 12:28:16 -07:00
Kir Kolyshkin
7797dcb2ab pkg/domain/infra/abi: modernize
Use slices.Contains instead of for loop. Suggested by modernize
(aka go fix).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-05-22 12:26:59 -07:00
Kir Kolyshkin
121948d69e pkg/rootless: modernize
Using modernize (aka go fix) from Go 1.26.3, implement the following
changes:

> pkg/rootless/rootless_linux.go:319:30: fmtappendf: Replace []byte(fmt.Sprintf...) with fmt.Appendf (modernize)
> 		err = os.WriteFile(uidMap, []byte(fmt.Sprintf("%d %d 1\n", 0, os.Geteuid())), 0o666)
> 		                           ^
> pkg/rootless/rootless_linux.go:339:30: fmtappendf: Replace []byte(fmt.Sprintf...) with fmt.Appendf (modernize)
> 		err = os.WriteFile(gidMap, []byte(fmt.Sprintf("%d %d 1\n", 0, os.Getegid())), 0o666)
> 		                           ^
> pkg/rootless/rootless_linux.go:381:6: rangeint: for loop can be modernized using range over int (modernize)
> 	for sig := 0; sig < numSig; sig++ {
> 	    ^
> pkg/rootless/rootless_linux.go:432:24: stringsseq: Ranging over SplitSeq is more efficient (modernize)
> 	for _, entry := range bytes.Split(data, []byte{0}) {
> 	                      ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-05-22 12:25:21 -07:00
Daniel J Walsh
f524bce46a Merge pull request #28753 from kolyshkin/os-is
Stop using os.Is{Exist,NotExist,Permission} checks
2026-05-22 05:18:45 -04:00
Tom Sweeney
3fb897f154 Merge pull request #28747 from kolyshkin/lint-nits
Remove unused nolint annotations
2026-05-21 19:58:34 -04:00
Kir Kolyshkin
7f7b35356f Replace os.Is* error checks with errors.Is
Using os.Is{Exist,NotExist,Permission} checks is not recommended in the
new code (see official documentation). While using it in the existing
code is OK, it may still result in a subtle errors later (for a specific
example of that, see [1]).

Replace those with errors.Is.

Generated by:

	gofmt -r 'os.IsExist(a) -> errors.Is(a, os.ErrExist)' -w .
	gofmt -r 'os.IsNotExist(a) -> errors.Is(a, os.ErrNotExist)' -w .
	gofmt -r 'os.IsPermission(a) -> errors.Is(a, os.ErrPermission)' -w .
	goimports -w .
	git diff vendor test/tools/vendor | patch -p1 -R

[1]: https://github.com/opencontainers/runc/pull/5061
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-05-21 13:09:42 -07:00
Paul Holzinger
23cc1a30fb Merge pull request #28735 from mvanhorn/fix/28298-podman-io-community-trailing-slash
docs(api): drop trailing slash on podman.io/community contact URL
2026-05-21 07:56:03 +02:00
Kir Kolyshkin
a7886d1fe8 Remove unused nolint annotations
The interfacer linter was removed a few years ago.

Remove the annotations as well.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-05-20 15:02:25 -07:00
Christopher Bii
a53c10ced0 compat API: populate HostConfig in container list response
- Populate the Docker-compatible container summary HostConfig from the
  container inspect data
- Remove the unused ContainerCreateConfig wrapper from the compat
  handler
- Add APIv2 test

Signed-off-by: Christopher Bii <christopherbii@hyub.org>
2026-05-20 03:27:14 -04:00
Gunjan Vyas
250e5f9914 use constant for timesync port and update mac_env.sh to print krunkit version
Signed-off-by: Gunjan Vyas <vyasgun20@gmail.com>
2026-05-20 12:56:50 +05:30
Brent Baude
6ef4d68da4 Merge pull request #28723 from SebTardif/fix/close-directory-handle-registries-d
pkg/trust: fix directory handle leak in loadAndMergeConfig
2026-05-19 15:58:39 -05:00
Brent Baude
3c4fb923f0 Merge pull request #28724 from SebTardif/fix/close-leaked-file-handles
Close leaked file handles in container config, CRIU stats, and playbook read
2026-05-19 15:56:27 -05:00
Matt Van Horn
f2a51888f3 docs(api): drop trailing slash on podman.io/community contact URL
The swagger spec generated from pkg/api/server/doc.go sets the contact
URL to https://podman.io/community/. That URL now returns 404, while
https://podman.io/community (no trailing slash) returns 200 and is what
the live site links to from its own navigation. Issue #28298 reports
the link as broken at the top of the rendered API reference, which is
where ReDoc surfaces the contact field.

Drop the trailing slash so the contact link in the generated swagger
spec resolves.

Signed-off-by: Matt Van Horn <mvanhorn@gmail.com>
2026-05-19 02:48:35 -07:00
Gunjan Vyas
e5bef8b124 machine: add vfkit timesync device for Apple VMs
Fixes: #28345

Signed-off-by: Gunjan Vyas <vyasgun20@gmail.com>
2026-05-19 13:23:01 +05:30
Jan Rodák
517070e750 Merge pull request #28673 from kyounghunJang/feat/add-volume-prune-dry-run
volume prune: add dry-run support
2026-05-18 19:26:18 +02:00
Sebastien Tardif
846d1a1b05 Close leaked file handles in container config, CRIU stats, and playbook read
Add missing defer Close() calls in four locations:

- libpod/container.go: specFromState() opens the container config file
  but never closes it after reading, leaking one fd per call.

- libpod/container_internal_common.go: checkpoint() and restore() each
  open the bundle directory for CRIU statistics but never close it,
  leaking one fd per checkpoint/restore operation.

- pkg/machine/shim/host.go: Init() opens the playbook file but never
  closes it after ReadAll, leaking one fd per machine init.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
2026-05-17 16:09:56 -07:00
Sebastien Tardif
39e5a0a0b9 Add unit tests for loadAndMergeConfig
Cover non-existent directory, empty directory, and existing testdata
directory paths to verify config merging and directory handle cleanup.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
2026-05-17 16:07:48 -07:00
Sebastien Tardif
72af655040 pkg/trust: fix directory handle leak in loadAndMergeConfig
The os.Open(dirPath) call opens a directory handle used for
Readdirnames() but never closes it, leaking one file descriptor
per call to loadAndMergeConfig().

Add defer dir.Close() after the error check.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
2026-05-17 13:51:04 -07:00
Byounguk Lee
e36e2c97d2 bindings/artifacts: remove redundant nameOrID parameter from Remove for 6.0
Signed-off-by: Byounguk Lee <nimdrak@gmail.com>
2026-05-17 08:11:53 +00:00
KyounghoonJang
3d899a8c25 volume prune: add dry-run support
Add a --dry-run option to show which volumes would be pruned without removing them.

Related: #27838
Signed-off-by: KyounghoonJang <matkimchi_@naver.com>
2026-05-16 19:03:34 +09:00
Maya Chen
2f17614d0e fix: duplicated words in decompress.go log message and annotations.go comment
Signed-off-by: Maya Chen <275405107+otjdiepluong@users.noreply.github.com>
2026-05-14 05:08:45 +00:00
Matthew Heon
3ac6501fdd API Handlers should not error on empty request bodies
This is a Docker compatibility change discovered while working on
cases it is practically speaking required because there are
mandatory parameters in the body, but in those cases you do not
get a JSON decode error back, you get an error about the field
that needs to be set. I see no reason for us not to match this
convention; it doesn't break our existing bindings, but makes
using the API via curl or similar somewhat easier.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2026-05-13 16:33:40 -04:00
nitz
b571943fe4 api: emit aux trailer with manifest digest on image push
The Docker daemon emits a final `{"aux":{"Tag","Digest","Size"}}` JSON
object on the push event stream so clients can recover the registry-side
manifest digest without an extra registry round-trip.

Several Docker-API clients (e.g. the Pulumi and Terraform docker
providers) parse `aux.Digest` to populate their pushed-image outputs.
Without the trailer they either silently fall back to inspecting the
local image (whose digest does not always match what was pushed - see
containers/podman#14779) or emit "Push completed without reporting a
digest" warnings.

`pushReport.ManifestDigest` is already populated with the correct
on-the-wire digest from `manifest.Digest(pushedManifestBytes)`; this
change just wraps it into the same JSON shape Docker emits and adds an
apiv2 test asserting the trailer is present with Tag, Digest, and Size.

Signed-off-by: nitz <nitz.raz@gmail.com>
2026-05-13 13:23:16 +03:00
Kir Kolyshkin
40e572f2ed Update oc/selinux to v1.14.1
There are some deprecations so done manually.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-05-11 11:04:23 -07:00
Paul Holzinger
a6e58ea101 wsl: remove custom registries.conf
This is already part of the base machine image, also with the overmount
of /etc/containers this would no loner be read anyway.

The machine-os update for this is here:
https://github.com/containers/podman-machine-os/pull/239

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-05-11 15:58:03 +02:00
Paul Holzinger
93b615c1f2 machine: move marker file to /etc/podman-machine
Matches changes from https://github.com/containers/container-libs/pull/779

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-05-11 15:58:03 +02:00
Paul Holzinger
e34f3bce0c machine: remove SSL_CERT_DIR/SSL_CERT_FILE copy
With podman 6 we have a --import-native-ca option that handles the
copying of certs much better.

As such remove our old legacy way of copying files these envs and also
the static certs.d dir. Since we now mount the full containers config
dir the certs from the cert.d are mounted already.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-05-11 15:58:03 +02:00
Paul Holzinger
b14e833ef6 machine: add test to check config mount
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-05-11 15:58:03 +02:00
Paul Holzinger
5e193ce96a wsl: mount config home dir like on other providers
The other providers use the volume mounts from containers.conf which
should take care of it. But because WSL is not using this we need to
hard code this ourselves.

Add a new custom unit to make systemd mount the path like we do for
podman socket mounts.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-05-11 15:58:03 +02:00
Paul Holzinger
41adad8ce9 machine test: combine three test cases
Each machine init boot takes a while, we can easily do this as part of
one test run to speed the overall machine test time up.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-05-11 15:58:03 +02:00
Jiwoo Ahn
ec583fa17f filters: add annotation filter for containers Fixes: #28562
Signed-off-by: Jiwoo Ahn <ikwydls1314@gmail.com>
2026-05-11 20:24:28 +09:00
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