Commit Graph

7211 Commits

Author SHA1 Message Date
Miloslav Trmač
b2d381c7a2 Inline createCommands into the caller
There is exactly one caller, with two code paths, and each only
needs _half_ of the function - and they really only share the
parentFlags and Quiet logic. It's easier to do things
directly.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2026-03-04 00:26:10 +01:00
Miloslav Trmač
a725f55ff1 Make CreateCommands and ScpCreateCommandsOptions private
They are entirely private, and the type has no reason to
exist in the API definitions.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2026-03-04 00:20:43 +01:00
Miloslav Trmač
acdaa5372e Don't use strings.Split(fmt.Sprintf("--a b ...", ...), " ")
When we have the _precise_ knowledge of where the parameter boundaries
are, and an API that allows us to express that, just _do that_ instead
of completely unnecessarily worrying about spaces in parameter values.

Also, this allows us to format the code to make the option and value
correspondence much easier to see.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2026-03-04 00:14:37 +01:00
Paul Holzinger
afab7a444d Merge pull request #27412 from dvorst/fix/rootless-podman-in-podman-on-wsl
Fix: Rootless Podman-in-Podman on WSL
2026-03-03 21:04:12 +01:00
Matt Heon
09ebdfa0b0 Merge pull request #28166 from mtrmac/platform-restriction
RFC: Add `(linux || freebsd)` build requirements
2026-03-03 10:27:57 -05:00
Miloslav Trmač
a37bf83dfc Also set DestinationCtx in a copy
It shouldn't actually affect anything, but it's easier
to set it than worry.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2026-03-02 23:17:13 +01:00
Miloslav Trmač
e04b77e600 Consolidate the call to bindings.NewConnectionWithOptions
... to centralize the conversion from entities.PodmanConfig
to bindings.Options, we will add more code there.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2026-03-02 23:17:13 +01:00
Miloslav Trmač
fd86c3c25f Use pullOptions.systemContext in getDestArtifact
Right now, this correctly handles pullOptions.credentials
which were ignored previously (admittedly that field is never set
by anything...); in the future, it will ensure the two c/image users
won't get out of sync again.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2026-03-02 23:17:12 +01:00
Miloslav Trmač
5946f7afcf Factor out pullOptions.systemContext from pull
We will add another user.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2026-03-02 23:17:12 +01:00
Miloslav Trmač
e807ae4350 Make ocipull.Pull and PullOptions private
There are no external users, so make that clearer.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2026-03-02 23:17:12 +01:00
Miloslav Trmač
2d4fb908a1 Pass all of Options to tcpClient
This will make it easier to add one more option,
and removes a risk of passing options in an incorrect order.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2026-03-02 23:17:12 +01:00
Jan Rodák
f49950c370 Merge pull request #28153 from timcoding1988/swagger-update
Swagger update:  Added missing documented params for already-supported api docs.
2026-03-02 16:40:18 +01:00
Jan Rodák
a11f22292e Merge pull request #28161 from ygalblum/quadlet-volume-mount-options
Quadlet Volume - allow setting mount option without a device
2026-03-02 16:37:35 +01:00
Miloslav Trmač
6beca1cbeb Back New{Container,Image} engine with the remote implementation on macOS
This way, the CLI can still call pkg/domain/infra, without needing
a "remote || linux || freebsd" build tag.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2026-02-27 22:18:55 +01:00
Miloslav Trmač
d06c4569f0 Make most of libpod, and everything that relies on it, non-darwin
Require (linux || freebsd), because the code already does that, in practice.
This just means macOS users of IDEs aren't hit with thousands of compilation
errors (and then the IDE can open an Linux-specific file and then process it
under the Linux assumption, which works much better).

This commit contains the parts that differ somehow.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2026-02-27 22:18:53 +01:00
Miloslav Trmač
4c3027c149 Make most of libpod, and everything that relies on it, non-darwin
Require (linux || freebsd), because the code already does that, in practice.
This just means macOS users of IDEs aren't hit with thousands of compilation
errors (and then the IDE can open an Linux-specific file and then process it
under the Linux assumption, which works much better).

This commit ONLY replaces
	//go:build !remote
with
	//go:build !remote && (linux || freebsd)

and is split from the rest to allow mechanically verifying that fact,
and focusing a review on the other kinds of changes.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2026-02-27 22:18:36 +01:00
dvorst
84eff9ef3b Fix: Rootless Podman-in-Podman on WSL
closes: #27411

Adjust SUB_UID and SUB_GID ranges to support running rootless Podman inside a rootless run Podman container.
Also add a test to verify the change and prevent regression.

By default, a new user is assigned the following sub-ID ranges:
  SUB_UID_MIN=100000, SUB_GID_MIN=100000, SUB_UID_COUNT=65536, SUB_GID_COUNT=65536
This means the user’s sub-UID and sub-GID ranges are 100000–165535.

When the container is run rootless with the user defined below, ID mappings occur as follows:
- Container ID 0 (root) maps to user ID 1000 on the host (which is the user created below).
- Container IDs 1–65536 map to IDs 100000–165535 on host (the subid range previously mentioned).

If a new user is created inside this container (to build containers for example), it will
attempt to use the default sub-ID range (100000–165535). However, this exceeds the container’s
available ID mapping, since only IDs up to 65536 are mapped. This causes nested rootless Podman
to fail.

To enable container-in-container builds, the sub-ID ranges for the user must be large enough
to provide at least 65536 usable IDs. A minimum SUB_UID_COUNT and SUB_GID_COUNT of 165536 is
required, but 1,000,000 is used here to provide additional margin.

1,000,000 matches the subid range other machines are using, defined in [ignition.go](69b397af49/pkg/machine/ignition/ignition.go (L284-L289)).
The script of other machines modify the subid files directly for 1 user, the `sed` command used in
this fix mimics that.

The test is added as en extension to the 'simple init with username' test case, to prevent having
to create a new VM.

Signed-off-by: dvorst <87502756+dvorst@users.noreply.github.com>
2026-02-27 10:52:14 +01:00
Ygal Blum
6c41f55aa7 Quadlet Volume - allow setting mount option without a device
Fixes: #28132

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2026-02-26 12:27:23 -05:00
Ygal Blum
64ec31ac00 Add nocreate option for named volumes
Add a per-volume 'nocreate' option that prevents automatic creation of
named volumes when they don't exist. When specified, Podman will fail
if the volume is not found instead of creating it automatically.

Usage: -v myvolume:/data:nocreate
       --mount type=volume,src=myvolume,dst=/data,nocreate

See: #27862
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2026-02-26 11:14:32 -05:00
Tim Zhou
e914c30dd5 update swagger changes
Signed-off-by: Tim Zhou <tizhou@redhat.com>
2026-02-26 09:51:15 -05:00
Jan Rodák
4e62f2429a Merge pull request #28138 from Luap99/golangci-lint
update golangci-lint to v2.10.1
2026-02-25 13:53:59 +01:00
Paul Holzinger
8a0c777017 fix new staticcheck warnings
As reported by golangci-lint v2.10.1.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-02-23 10:00:51 +01:00
Paul Holzinger
5e3719c81a fix two issues found by nilness
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-02-23 09:53:35 +01:00
Patrick Koenig
0d7f00b4c0 List all status values in status filter documentation
Signed-off-by: Patrick Koenig <pkoenig10@gmail.com>
2026-02-19 09:28:37 -05:00
Paul Holzinger
a3198235bf bindings: do not validate source policy on the client
The client and server version can mismatch in which case the client may
fail on something the newer server can understand or the other way
around. Given the server has to parse and validate that output no matter
what there does not seem to be a strong argument for doing this on the
client side again.

Also this means we do leak the sourcepolicy package into the remote
client.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-02-18 14:18:44 +01:00
Nalin Dahyabhai
474ff994b6 build: connect --source-policy-file, --mount for remote builds
Pass --mount settings and the contents of the --source-policy-file
argument to remote builds.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-02-18 14:11:12 +01:00
Jan Rodák
38e1aa7ba0 Merge pull request #28085 from JCBird1012/main
compat/api: honor VolumeOptions.Subpath for HostConfig.Mounts
2026-02-18 10:48:54 +01:00
Paul Holzinger
f4aa01967e Merge pull request #28099 from Honny1/quadlets-restart-pod
Respect user-specified `Restart=` policy in pod units
2026-02-17 12:49:20 +01:00
Jan Rodák
33e8abd637 Respect user-specified Restart= policy in pod units
Fixes: https://github.com/containers/podman/issues/28081

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-02-16 22:12:18 +01:00
Paul Holzinger
a1afa58e27 system service: remove config reload functionallity
As I outlined in the design docs this is broken, there are several
data races here because we write to the config files that can be read by
other goroutines in parallel which violates the go memory model and
thus can lead to runtime panics and undefined behavior.
One could fix with a mutex but that would make the whole code base much
more ugly and there is still the risk that something would access this
field without the mutex held.

I am not sure we have any users using this, it never worked for the
storage side and since the service is a not a daemon any user could just
stop and start it again to re-read the files without having to stop
running containers.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-02-16 13:47:56 +01:00
Jonathan Caicedo
b584337bd6 compat/api: honor VolumeOptions.Subpath for HostConfig.Mounts
fixes: #27171
Signed-off-by: Jonathan Caicedo <jonathan@jcaicedo.com>
2026-02-13 12:47:54 -05:00
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