Commit Graph

7180 Commits

Author SHA1 Message Date
Paul Holzinger
88bd85367d Merge pull request #28008 from shiv-tyagi/vendor-detection
Discover GPU vendor from CDI spec before injecting GPU for --gpus option
2026-02-12 18:54:34 +01:00
Shiv Tyagi
d7a80dda1e Discover vendor from cdi spec before injecting CDI device for --gpu option
Signed-off-by: Shiv Tyagi <Shiv.Tyagi@amd.com>
2026-02-12 12:11:47 +00:00
Kir Kolyshkin
94442ae44e pkg/machine/e2e: simplify runWslCommand
runWslCommand never returns err != nil because if there's an error, it
calls Fail (which panics, so the code after it is unreachable).

Remove error returning and checking.

Inspired by the following linter warning:

> pkg/machine/e2e/config_windows_test.go:59:56: runWslCommand - result 1 (error) is always nil (unparam)
> func runWslCommand(cmdArgs []string) (*machineSession, error) {
>                                                        ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-02-11 11:41:11 -08:00
Kir Kolyshkin
f9002cfd31 Fix GOOS=windows prealloc linter warnings
These ones:

> cmd/winpath/main.go:148:2: directive `//nolint:prealloc` is unused for linter "prealloc" (nolintlint)
> 	//nolint:prealloc
> 	^
> pkg/machine/hyperv/vsock/vsock.go:425:2: Consider preallocating allSocks (prealloc)
> 	allSocks := []*HVSockRegistryEntry{}
> 	^
> pkg/machine/wsl/machine.go:464:2: Consider preallocating newArgs with capacity 4 + len(arg) (prealloc)
> 	newArgs := []string{"-u", "root", "-d", dist}
> 	^
> pkg/machine/wsl/machine.go:471:2: Consider preallocating newArgs with capacity 4 + len(arg) (prealloc)
> 	newArgs := []string{"-u", "root", "-d", dist}
> 	^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-02-11 11:41:11 -08:00
Kir Kolyshkin
2a99655120 machine: prepend LocalhostSSHArgs to args
Rather than append LocalhostSSHArgs to args, prepend it, assuming the
order doesn't matter here.

This fixes the following prealloc warning (without decreasing
readability):

> cmd/podman/machine/cp.go:130:2: Consider preallocating args (prealloc)
> 	args := []string{"-r", "-i", sshConfig.IdentityPath, "-P", strconv.Itoa(sshConfig.Port)}
> 	^

This commit is part of series fixing issues reported by prealloc linter
from golangci-lint v2.8.0.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-02-11 11:41:11 -08:00
Kir Kolyshkin
b046387979 Inline the initial slice into append
Instead of creating a slice and then appending to it, let's inline the
initial slice into append. This may or may not result in less slice
reallocations, but it is silencing the prealloc linter warnings.

This commit is part of series fixing issues reported by prealloc linter
from golangci-lint v2.8.0.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-02-11 11:41:10 -08:00
Kir Kolyshkin
38f6bf07cc pkg/emulation: remove slice copying
Copying the slice is not necessary here since registeredBinfmtMisc
always creates the slice from scratch.

This commit is part of series fixing issues reported by prealloc linter
from golangci-lint v2.8.0.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-02-11 11:41:10 -08:00
Kir Kolyshkin
030057aecd Preallocate a slice
When we already know the resulting slice size but still need/want to use
append, it makes sense to preallocate the slice by using make with the
capacity argument.

This commit is part of series fixing issues reported by prealloc linter
from golangci-lint v2.8.0.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-02-11 11:41:10 -08:00
Kir Kolyshkin
d316cbb362 Don't use append if not necessary
Calling append can lead to resizing the slice. In case we have all
elements beforehand, it is not necessary to call append in the first
place and this avoid resizing.

This is the first part of fixing issues reported by prealloc linter from
golangci-lint v2.8.0.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-02-11 11:41:10 -08:00
Šimon Brauner
9727a43f5a Added setting UID and GID for volumes in quadlet
Related: https://issues.redhat.com/browse/RHEL-145863

Signed-off-by: Šimon Brauner <sbrauner@redhat.com>
2026-02-11 18:16:30 +01:00
Matt Heon
d220d58f08 Merge pull request #27993 from danishprakash/podman-buildah-vendor
vendor: update c/buildah to latest main
2026-02-04 16:02:39 -05:00
Paul Holzinger
8fbda3fbef Merge pull request #27999 from baude/applytransports
add bootc transports to os-apply
2026-02-03 14:53:18 +01:00
Mayowa Fajobi
1bfd4cb95b Fix healthcheck argument with spaces split in Docker API (#27818)
Fixes: #26519

Signed-off-by: MayorFaj <mayorfaj@gmail.com>
2026-02-03 12:49:28 +01:00
Paul Holzinger
cadc74b796 Merge pull request #27995 from chkpnt/proxyenv
Write DefaultEnvironment proxy values to /etc/systemd/user.conf.d/default-env.conf
2026-02-03 12:48:21 +01:00
Mario Loriedo
6e053689d5 Merge pull request #27795 from MayorFaj/fix-env-envfrom-precedence-27287
fix: ensure environment variable precedence between env and envFrom
2026-02-03 11:31:59 +01:00
Danish Prakash
827ba37b3e build: handle --iidfile-raw and --metadata-file flags
* docs: man page additions
* test/e2e: add tests for `--iidfile-raw` and `--metadata-file`
* test/buildah-bud: update buildah-bud test patch for buildah v1.42.1

Signed-off-by: Danish Prakash <contact@danishpraka.sh>
2026-02-03 09:18:29 +05:30
Brent Baude
40b2a585f9 Autocomplete machine fixes
Fixups for autocomplete for machine commands.  This was authored by Paul
Holzinger.

Thank you very much!

Signed-off-by: Brent Baude <bbaude@redhat.com>
2026-02-02 15:19:37 -06:00
Brent Baude
f4138d3599 add bootc transports to os-apply
now that we use `bootc switch` for changing out-of-band updates, we can
consider also using some of their supported transports.

* containers-storage
* oci
* oci-archive
* registry

RUN-3963
Signed-off-by: Brent Baude <bbaude@redhat.com>
2026-02-02 09:07:08 -06:00
Gregor Dschung
644bf2e04a Fix interfering escaping of commas and spaces in no_proxy variable
Signed-off-by: Gregor Dschung <gregor@chkpnt.de>
2026-02-02 15:49:25 +01:00
Gregor Dschung
a6167bdecc Write DefaultEnvironment proxy values to /etc/systemd/user.conf.d/default-env.conf
Otherwise, the proxy values aren't passed to rootless podman.

Signed-off-by: Gregor Dschung <gregor@chkpnt.de>
2026-02-02 15:49:05 +01:00
Gregor Dschung
e545f9ca61 Fix test proxyenv/env_test.go for systems that use proxy variables
Signed-off-by: Gregor Dschung <gregor@chkpnt.de>
2026-02-02 15:42:00 +01:00
Brent Baude
3d4f25e6d3 Merge pull request #27936 from inknos/get-exists-quadlet-api
Add GET /quadlets/{name}/exists
2026-01-28 10:58:46 -06:00
Brent Baude
b60d234da4 Merge pull request #27827 from lsm5/podman6-no-cni
Podman6: Remove CNI
2026-01-28 10:20:56 -06:00
Chawye Hsu
ce568f75dc chore(machine): remove unused EvalSymlinksOrClean function and tests
Related to https://github.com/containers/container-libs/pull/612

Signed-off-by: Chawye Hsu <su+git@chawyehsu.com>
2026-01-28 02:42:45 +08:00
Nicola Sella
eb0c4716d3 Add GET /quadlets/{name}/exists
Fixes: https://issues.redhat.com/browse/RUN-4068

Signed-off-by: Nicola Sella <nsella@redhat.com>
2026-01-27 16:10:56 +01:00
Lokesh Mandvekar
454167efa9 Remove CNI-specific code paths from libpod
Remove CNI-specific conditional logic and update comments throughout
the libpod networking code:

- Simplified DNS configuration logic in container_internal_common.go
  to always use netavark behavior (removed backend checks)
- Removed CNI-specific iptables chain error regex pattern
- Updated all comments referencing 'CNI' to use 'netavark' or
  'network backend'
- Renamed variable 'cniNet' to 'netInfo' for clarity
- Updated field and type documentation to remove CNI references

All networking code now assumes netavark as the sole backend.

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2026-01-27 16:32:38 +05:30
Lokesh Mandvekar
f6bddc8af2 Remove CNI backend configuration from runtime
Remove runtime configuration options for CNI network backend:

Runtime options:
- Remove WithNetworkBackend() runtime option function
- Function allowed setting network backend programmatically

Flag handling:
- Remove --network-backend flag change detection
- Remove call to WithNetworkBackend() when flag changed
- Remove TODO comment about CNI plugins directory flag

The network backend configuration is now handled entirely by the
vendored common/libnetwork code, which will default to Netavark.
There is no longer any way to configure CNI as the network backend
through Podman's runtime initialization.

Note: libpod/info.go keeps existing NetworkBackend reporting logic
which will automatically report "netavark" as the only backend since
configuration defaults to netavark and cannot be changed to CNI.

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2026-01-27 16:32:38 +05:30
Lokesh Mandvekar
73ef7cfcdc Remove CNI backend from CLI options and completions
Remove user-facing CLI options for CNI network backend:

CLI flags:
- Keep --network-backend global flag as hidden and deprecated for
  backward compatibility with cleanup commands from 5.x containers
- Map flag to a throwaway variable (value is ignored)
- Remove shell completion for network backend values

Shell completions:
- Remove AutocompleteNetworkBackend() function
- Remove references to CNI and Netavark type constants

Backward compatibility:
- Remove --rootless-cni flag alias for podman unshare
- Remove SetNormalizeFunc that mapped rootless-cni to rootless-netns
- Update --rootless-netns flag description to mention only netavark

The --network-backend flag remains as a hidden deprecated flag to
prevent failures when upgrading from 5.x where containers may have
cleanup commands that include this flag. The flag is accepted but
ignored. Users can no longer specify CNI as a network backend option.
The --rootless-cni alias is removed; users must use --rootless-netns.

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2026-01-27 16:32:38 +05:30
Brent Baude
2d67bf3b0a Vendor common test for artifact digest lookup
Vendor latest common with artifact changes

Signed-off-by: Brent Baude <bbaude@redhat.com>
2026-01-26 15:45:56 -06:00
Paul Holzinger
c4128cbc40 Merge pull request #27880 from giuseppe/drop-pause-process
rootless: use nsfs file handles to persist namespaces
2026-01-23 13:15:56 +01:00
MayorFaj
d8f5368428 fix: correct env/envFrom precedence in kube play
Fixes: #27287

Signed-off-by: MayorFaj <mayorfaj@gmail.com>
2026-01-22 19:55:57 +00:00
lstocchi
cfa1b51775 fix hyperv ignition cleanup and error handling
this fixes two bugs in Hyper-V VM ignition handling:

1. Changed `err := readAndSplitIgnition()` to
`err = readAndSplitIgnition()` so the deferred cleanup function can
properly detect errors and clean up ignition
2. The function was trying to remove keys with pattern `vm.ElementName + index`, but
the actual keys were created using `"ignition.config." + index` pattern.

It also improve the deletion by calculating in how many parts the ignition file is splitted when being added in the registry and delete just them instead of blidnly iterating through 0-50.

Signed-off-by: lstocchi <lstocchi@redhat.com>
2026-01-21 15:50:17 +01:00
Giuseppe Scrivano
f172ff789b rootless: use nsfs file handles to persist namespaces
use name_to_handle_at and open_by_handle_at to persist rootless
namespaces without needing a pause process.

The namespace file handles are stored in a file and can be used to
rejoin the namespaces, as long as the namespaces still exist.

Fall back to the pause process approach only when the kernel doesn't
support nsfs handles (EOPNOTSUPP).

The feature is currently only enabled when the PODMAN_NO_PAUSE_PROCESS
environment variable is set.

These changes in the kernel are required (landed in Linux 6.18):

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3ab378cfa793

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2026-01-20 18:41:59 +01:00
Brent Baude
aba2df7517 Add podman machine os upgrade command
Implements automatic OS upgrade functionality for Podman machines that requires no user input beyond running the command. The upgrade logic automatically determines the appropriate upgrade path using a three-way comparison between client version, machine version, and OCI registry:

* When the client version is older than the machine version, no action is taken and an error is returned.
* When the client version matches the machine version, the OCI registry is queried to check for in-band updates by comparing image digests.  This handles minor, patch level, and updates oci image use cases.
* When the client version is newer than the machine version, the machine is upgraded to match the client's major.minor version.
* No manual image selection or version specification required.

The command supports dry-run mode and JSON (only) output format for automation.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2026-01-16 14:14:06 -06:00
Tom Sweeney
8a33866ecd Merge pull request #27860 from ygalblum/quadlet-pod-template
Quadlet - do not link pod service units to quadlet templates - merging as our auto-merge bot seems to be offline at the moment.
2026-01-16 09:34:45 -05:00
Matt Heon
cb67dafd36 Merge pull request #26445 from aaron-ang/update-ulimit
Add ulimits to `podman update`
2026-01-16 08:38:00 -05:00
Ygal Blum
0d3c438803 Quadlet - do not link pod service units to quadlet templates
When a template container unit is linked to a pod do not add
its service to the pod units dependency

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

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2026-01-15 09:23:01 -05:00
Nicola Sella
2e23fcc5a5 Add DELETE /libpod/quadlets
Fixes: https://issues.redhat.com/browse/RUN-3742

Signed-off-by: Nicola Sella <nsella@redhat.com>
2026-01-15 12:10:32 +01:00
Mario Loriedo
7c9d4a42c5 Merge pull request #27885 from lstocchi/i27615
Prevent starting and stopping legacy hyperv machines when not elevated
2026-01-13 14:38:07 +01:00
lstocchi
ca44e3a4d7 Fix race condition in CleanupGVProxy when reading gvproxy PID file
When startVM fails quickly, CleanupGVProxy may attempt to read the
gvproxy.pid file before gvproxy has written it, causing cleanup to
fail.

This commit adds retry logic that waits up to 2 seconds for the PID
file to appear.

Signed-off-by: lstocchi <lstocchi@redhat.com>
2026-01-09 08:07:04 +01:00
lstocchi
d2ea5a3fd0 prevent starting/stopping legacy Hyper-v machines when not elevated
Podman 5.x and earlier required to run as admin to work with Hyper-v.
Starting from Podman 6 this is not mandatory anymore as Registry
entries are handled differently. However, it may
happen the user have a legacy machine running when switching to Podman 6
or starts an old machine in elevated mode and then tries to stop it as a
normal user with Podman 6. If that happens the system will end up in a corrupted state
as the gvproxy process will not be stopped.
To prevent such scenario and issues, this commit maintains the original
behavior Podman 5.x has. Legacy Hyper-v machines needs to be handled
with elevated rights.

Signed-off-by: lstocchi <lstocchi@redhat.com>
2026-01-09 08:07:00 +01:00
Brent Baude
76e14f79f7 use bootc for os apply
Instead of using rpm-ostree, we now use bootc for os apply.  the
implementation is a little murky right now and will require some cleanup
to implement bootc's transports.  for now, we only support oci images
from registries.

once we have an upgrade command, the transports can be added and the
docs for apply can be ammended to be more clear.

Fixes: RUN-3836

Signed-off-by: Brent Baude <bbaude@redhat.com>
2026-01-08 13:32:39 -06:00
shiavm006
90f45bca77 extract shared TTY handling code into helper function
Signed-off-by: shiavm006 <shivammittal42006@gmail.com>
2026-01-07 10:19:38 +05:30
Matt Heon
2fbecb48e1 Merge pull request #27791 from ninja-quokka/kube_play_image_validation
[play_kube] Add validation to container image field
2025-12-22 14:43:56 -05:00
Lewis Denny
74c0795a7c [play_kube] Add validation to container image field
Fixes: #27784

Signed-off-by: Lewis Denny <lewisdenny@me.com>
2025-12-21 20:15:35 +10:00
Ashley Cui
aa1d7b189a Remove network-cmd-path
As part of slirp removal.
RUN-3569

Signed-off-by: Ashley Cui <acui@redhat.com>
2025-12-19 16:52:49 -05:00
Matt Heon
ac91395e1d Merge pull request #27696 from MayorFaj/fix-logs-timestamp-precision
fix(logs): improve timestamp precision in container logs
2025-12-17 15:41:43 -05:00
Matt Heon
8b9c1e2ad3 Merge pull request #27781 from cgwalters/fprintf-trailing-nl
Fix missing newlines in stderr error messages
2025-12-17 12:21:03 -05:00
Nicola Sella
3e6781f05a Add POST /libpod/quadlets
Fixes: https://issues.redhat.com/browse/RUN-3743

Signed-off-by: Nicola Sella <nsella@redhat.com>
2025-12-17 14:37:12 +01:00
Colin Walters
9a2c8b615e Fix missing newlines in stderr error messages
I happened to run `podman run --config=/path/to/file` and got
an error without a trailing newline, which was a bit jarring.

Fix the instances I noticed.

Assisted-by: OpenCode (Claude Opus 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
2025-12-17 07:36:04 -05:00