7231 Commits

Author SHA1 Message Date
Paul Holzinger
14dd313d41 Merge pull request #27766 from Banana-Cultist/podman-events-oom
Improve OOMKilled Visibility
2026-03-12 19:23:02 +01:00
Paul Holzinger
1f3c344312 run modernize -fix ./...
modernize seems to be smarter now so it found some more things that are
not even go 1.25 related.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-03-12 17:22:01 +01:00
Paul Holzinger
faa9b02d8f Merge pull request #28259 from timcoding1988/fix-subuid-trailing-newline
fix: add trailing newline to /etc/subgid for shadow-utils >= 4.19.0 (F44+)
2026-03-12 16:34:48 +01:00
Tim Zhou
0904bab01e add trailing newline to subgid due to shadow-utils 4.19.0 regression
Fedora 44 come with shadow-utils 4.19.0, This is a POSIX compliance fix - text files need end with a newline.
1. https://github.com/containers/podman-machine-os/issues/226
2. https://github.com/shadow-maint/shadow/issues/1581

Signed-off-by: Tim Zhou <tizhou@redhat.com>
2026-03-12 09:49:44 -04:00
Tim Zhou
a414460351 chore(api): add swagger docs for undocumented API parameters
Add documentation for undocumented API parameters across multiple endpoints:

System:
- POST /libpod/system/prune: all, volumes, external, build, filters

Pods:
- DELETE /libpod/pods/{name}: timeout
- GET /libpod/pods/stats: stream, delay

Volumes:
- DELETE /volumes/{name}: timeout
- DELETE /libpod/volumes/{name}: timeout

Containers:
- GET /libpod/containers/stats: all
- POST /libpod/containers/{name}/restart: timeout
- POST /libpod/containers/{name}/resize: running

Images:
- POST /images/create: retry, retryDelay
- GET /images/json: shared-size

Exec:
- POST /libpod/exec/{id}/resize: running

Generate:
- GET /libpod/generate/{name}/systemd: templateUnitFile

Signed-off-by: Tim Zhou <tizhou@redhat.com>
2026-03-11 23:19:30 -04:00
Bruce Fan
ffeb0d103b Improve OOMKilled visibility in podman events and in podman inspect docs
Signed-off-by: Bruce Fan <brucexfan@gmail.com>
2026-03-11 10:15:56 -05:00
Paul Holzinger
4f1d4ae8a0 fix new lint issues from prealloc
Fix a few new issues reported by the linter update.

There is no need to copy the capAdd/capDrop slice in the compat create
endpoint as they are only read and not modified.
For the other code preallocate the slices so we safe memory allocations.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-03-10 19:45:35 +01:00
Giuseppe Scrivano
458fcaa1ba specgen: fix pod mount options leaking between mounts
Replace the JSON marshal/unmarshal round-trip in Inherit() with
copier.Copy. json.Unmarshal reuses existing slice backing arrays
and does not zero struct fields absent from the JSON (omitempty),
so mount options like "ro" from one mount would leak into another
mount at the same backing-array position.

Fixes the case where running:
  podman run --pod mypod \
    --mount type=bind,src=/a,target=/mylog \
    --mount type=bind,src=/b,target=/mytmp,ro=true \
    alpine touch /mylog/a

incorrectly fails with "Read-only file system" because /mylog
inherits "ro" from /mytmp.

Fixes: https://issues.redhat.com/browse/RHEL-154348

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2026-03-10 09:14:38 +01:00
Šimon Brauner
76095dbadc Make libpod return error status code on failure to pull image
Fixes: https://github.com/containers/podman/issues/22105

Signed-off-by: Šimon Brauner <sbrauner@redhat.com>
2026-03-09 14:26:14 +01:00
Jan Kaluza
01688e7621 Deprecate Legacy structs and use port.String()
Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2026-03-09 11:09:28 +01:00
Jan Kaluza
c10f685b43 api/compat: Backport jsonmessage.JSONProgress.String()
The JSONProgress is not part of moby/moby API anymore:
f4127d76c5

To stay compatible with the previous client version, this commit backports
the jsonmessage.JSONProgress.String() and uses it to genereate
the progress report.

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2026-03-09 11:09:28 +01:00
Jan Kaluza
65585e4338 compat/network: Remove temporary ipvAddress variables.
Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2026-03-09 11:09:28 +01:00
Jan Kaluza
56e555bfc2 api/compat: switch to moby/moby
Replace github.com/docker/docker API imports with github.com/moby/moby
across compat handlers, swagger models, and tests to align with upstream
type definitions.

Fixes: #27536.

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2026-03-09 11:09:23 +01:00
Paul Holzinger
5adac65c0a Merge pull request #28208 from mtrmac/tls-behavior-basics
Add --tls-details for (pull, push, run, login, logout)
2026-03-06 16:33:38 +01:00
Povilas Kanapickas
636eb1a401 libpod: Implement --log-opt label=LABEL=Value
This allows things like compose project names to be associated with log
messages and later used in log processing and analysis.

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2026-03-06 10:59:31 +02:00
Miloslav Trmač
13e1d5af4b PARTIALLY TESTED: Add --tls-details, use it to affect libimage and the like
For remote operation, start the remote service with --tls-details:
using --tls-details on the client side will only affect client's
connection.

This should eventually include many more tests - track down all current
uses of libpod.Runtime.{SystemContext,imageContext,LibimageRuntime}.
That will come later

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2026-03-05 23:13:17 +01:00
Paul Holzinger
a2f0e0da47 artifact: do not set SystemContext in CopyOptions
We set it not nil anyway so it is not used and it is already removed
from common:
544c8fc8cf

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-03-05 12:53:40 +01:00
Povilas Kanapickas
9872cbd756 libpod: Validate that log tag requires journald driver
Currently validation that log tag requires journald driver is done in several
places and emits only warning. Making it an error and moving to
`(c *Container) validate()` is a more correct approach.

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2026-03-04 14:48:46 +02:00
Paul Holzinger
8aad8d72e0 Merge pull request #28140 from ozgur-as/fix-clone-secret-env
Fix container clone with secret type=env
2026-03-04 13:04:11 +01:00
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
Ozgur As
03d9de1528 Fix container clone with secret type=env
ConfigToSpec() serializes the container config to JSON and deserializes
it into a SpecGenerator. Both structs use the JSON tag "secret_env" but
with incompatible types: the container config uses map[string]*secrets.Secret
(complex objects) while the specgen uses map[string]string (env var name
to secret name). This causes an unmarshal error when cloning containers
that use --secret with type=env.

Fix this by saving and clearing EnvSecrets before JSON marshal (same
pattern as existing tmpSystemd/tmpMounts), then converting the secret
objects to name strings and assigning them to the specgen afterward.

Also fix FillOutSpecGen to not overwrite env secrets populated by
ConfigToSpec when no new secrets are provided on the command line.

Fixes: #28130
Signed-off-by: Ozgur As <ozgur@live.com>
2026-02-25 19:53:36 +03: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