Commit graph

4667 commits

Author SHA1 Message Date
Jan Rodák
0b2d7729c5
Merge pull request #29654 from Atishyy27/fix/subpath-equals-truncation
Some checks are pending
ci / int local rootless fedora-prior (push) Blocked by required conditions
ci / sys local rootless fedora-prior (push) Blocked by required conditions
ci / int remote root fedora-prior (push) Blocked by required conditions
ci / sys remote root fedora-prior (push) Blocked by required conditions
ci / int local root fedora-rawhide (push) Blocked by required conditions
ci / sys local root fedora-rawhide (push) Blocked by required conditions
ci / int local rootless fedora-rawhide (push) Blocked by required conditions
ci / sys local rootless fedora-rawhide (push) Blocked by required conditions
ci / int remote root fedora-rawhide (push) Blocked by required conditions
ci / sys remote root fedora-rawhide (push) Blocked by required conditions
ci / apiv2 root fedora-current (push) Blocked by required conditions
ci / bindings root fedora-current (push) Blocked by required conditions
ci / compose_v2 root fedora-current (push) Blocked by required conditions
ci / docker_py root fedora-current (push) Blocked by required conditions
ci / unit root fedora-current (push) Blocked by required conditions
ci / apiv2 rootless fedora-current (push) Blocked by required conditions
ci / compose_v2 rootless fedora-current (push) Blocked by required conditions
ci / farm rootless fedora-current (push) Blocked by required conditions
ci / unit rootless fedora-current (push) Blocked by required conditions
ci / upgrade v5.3.1 root fedora-current (push) Blocked by required conditions
ci / upgrade v5.6.2 root fedora-current (push) Blocked by required conditions
ci / machine linux amd64 (push) Blocked by required conditions
ci / windows unit (push) Blocked by required conditions
ci / windows e2e (push) Blocked by required conditions
ci / windows machine hyperv (push) Blocked by required conditions
ci / windows machine wsl (push) Blocked by required conditions
ci / macos machine applehv (push) Blocked by required conditions
ci / macos machine libkrun (push) Blocked by required conditions
ci / Total Success (push) Blocked by required conditions
zizmor: GitHub Actions Security Analysis / Zizmor (push) Waiting to run
fix(libpod): keep '=' in a volume subpath
2026-09-01 13:55:17 +02:00
Paul Holzinger
9242ecc42f
Merge pull request #29673 from Xiaowen-Yang/codex/fix-29664-attach-exited
api: avoid reinitializing exited containers on logs-only attach
2026-09-01 12:36:00 +02:00
Giuseppe Scrivano
c56c2fc5f8
libpod: do not block idmap with overlay (O) volumes
Allow the `idmap` volume option to be combined with the overlay `O`
option, e.g. `-v /src:/mnt:O,idmap` or `-v myvol:/mnt:O,idmap`.
Previously any option other than `U`, `upperdir` and `workdir` combined
with `O` was rejected.

The parser in GenVolumeMounts now accepts `idmap` alongside `O` and
rejects the first disallowed option instead of counting flags.  The
mappings from the container's user namespace are threaded onto the
generated overlay mount so the runtime idmaps it.  This is done for both
the anonymous/host-path overlay volumes and the named-volume overlay
path, which are handled by separate code.

When a volume is idmapped the runtime shifts the mount so that on-disk
IDs map identically into the container, so the overlay backing dirs
(contentDir, upperdir, workdir) must be owned by real root (0) rather
than the host IDs the container root maps to; otherwise they surface as
the overflow ID inside the container and are inaccessible.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2026-09-01 09:50:51 +02:00
Giuseppe Scrivano
58489b82b4
libpod: fix :O overlay volumes in a userns
When the user owning the storage is not mapped into the container user
namespace (e.g. root with --userns=auto), the runtime cannot mount an
overlay volume from inside the user namespace.

Mount the overlay in podman instead and pass the runtime a bind mount.

Closes: https://github.com/podman-container-tools/podman/issues/28758

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2026-09-01 09:50:51 +02:00
Xiaowen-Yang
1c8f2963a1 Preserve exited state for logs-only HTTP attach
Fixes: #29664
Signed-off-by: Xiaowen-Yang <xiaowenyang52@gmail.com>
2026-08-31 20:31:24 +02:00
Atishyy27
44f7900e0d
fix(libpod): keep '=' in a volume subpath
The subpath mount option is parsed with strings.Split(o, "=")[1], so it keeps only
the text between the first and second '='. A subpath that contains '=' gets cut
short and the container mounts a different directory than the one that was asked for.

    --mount type=volume,src=v,dst=/mnt,subpath=/opt/a=b/c   mounts /opt/a

Signed-off-by: Atishyy27 <sethatishayjain@gmail.com>
2026-08-27 18:20:55 +05:30
Jiwoo Ahn
63ab237222 libpod(refactor): optimize directory empty check
No need to read the entire directory for empty check. Extract redundant check into helper

Signed-off-by: Jiwoo Ahn <ikwydls1314@gmail.com>
2026-08-26 16:40:12 +09:00
Jiwoo Ahn
de4333ce06 libpod: fix permissions for imported volumes
Imported volumes now get ownership and permissions matching the
container's mount tareget.

Previously, permission adjustment was skipped for imported volumes as
they were already non-empty when mounted.

Fixes: #25442

Signed-off-by: Jiwoo Ahn <ikwydls1314@gmail.com>
2026-08-21 17:35:23 +09:00
Paul Holzinger
5c9779cc5d
Merge pull request #29576 from ravencore06/test/reduce-flaky-test-sleep
test: synchronize SHM lock test
2026-08-19 12:36:24 +02:00
Srinidhi
a34c978984 test: synchronize SHM lock test
Signed-off-by: Srinidhi <srinidhisadhanala@gmail.com>
2026-08-18 16:57:53 +05:30
Jan Rodák
4b6873a5ef
Merge pull request #29527 from vishnukothakapu/perf-strings-equalfold
Performance: Replace strings.ToLower with strings.EqualFold
2026-08-17 21:59:25 +02:00
Matt Heon
fe1f1cb5b8
Merge pull request #29499 from KHARSHAVARDHAN-eng/fix-29491-event-logger-goroutine-leak
events: fix goroutine leak when using --until with dropped contexts
2026-08-17 15:39:11 -04:00
Jan Rodák
9482f83760
Merge pull request #29479 from HindzStark/fix-copy-event-status
events: add missing Copy status to StringToStatus
2026-08-17 14:55:00 +02:00
Harsha Vardhan
f7caec8ed6 test(events): remove redundant until cancellation test
Remove the redundant context cancellation test as requested during review.

Fixes: https://github.com/podman-container-tools/podman/issues/29491

Signed-off-by: Harsha Vardhan <harshahvk2005@gmail.com>
2026-08-17 16:44:32 +05:30
Paul Holzinger
5b366f4b34
Merge pull request #29511 from vishnukothakapu/perf-regexp-mustcompile
Performance: Hoist regexp.MustCompile out of functions
2026-08-17 12:53:04 +02:00
Vishnu Kothakapu
0a2350324a Performance: Replace strings.ToLower with strings.EqualFold
Replaces unnecessary heap allocations for case-insensitive equality
checks with standard library strings.EqualFold.

Fixes: #29526
Signed-off-by: Vishnu Kothakapu <vishnukothakapu27@gmail.com>
2026-08-15 02:17:47 +05:30
dhruv
71ba456cd0 events: add missing Copy status to StringToStatus
Signed-off-by: dhruv <dhruvdkjk@gmail.com>
2026-08-14 22:24:44 +05:30
Vishnu Kothakapu
e3797d95b1 Performance: Use delayed regex compilation
Replaces regexp.MustCompile with regexp.Delayed from go.podman.io/storage/pkg/regexp
for global regular expressions. This avoids compiling regular expressions
during the global init scope, improving startup performance for all commands.

Tests are kept using regexp.MustCompile where applicable.

Fixes: #29510
Signed-off-by: Vishnu Kothakapu <vishnukothakapu27@gmail.com>
2026-08-14 21:14:17 +05:30
Matt Heon
3a18c5e98f
Merge pull request #29279 from vtushar06/fix-prune-build-race
Some checks are pending
ci / int local rootless fedora-prior (push) Blocked by required conditions
ci / sys local rootless fedora-prior (push) Blocked by required conditions
ci / int remote root fedora-prior (push) Blocked by required conditions
ci / sys remote root fedora-prior (push) Blocked by required conditions
ci / int local root fedora-rawhide (push) Blocked by required conditions
ci / sys local root fedora-rawhide (push) Blocked by required conditions
ci / int local rootless fedora-rawhide (push) Blocked by required conditions
ci / sys local rootless fedora-rawhide (push) Blocked by required conditions
ci / int remote root fedora-rawhide (push) Blocked by required conditions
ci / sys remote root fedora-rawhide (push) Blocked by required conditions
ci / apiv2 root fedora-current (push) Blocked by required conditions
ci / bindings root fedora-current (push) Blocked by required conditions
ci / compose_v2 root fedora-current (push) Blocked by required conditions
ci / docker_py root fedora-current (push) Blocked by required conditions
ci / unit root fedora-current (push) Blocked by required conditions
ci / apiv2 rootless fedora-current (push) Blocked by required conditions
ci / compose_v2 rootless fedora-current (push) Blocked by required conditions
ci / farm rootless fedora-current (push) Blocked by required conditions
ci / unit rootless fedora-current (push) Blocked by required conditions
ci / upgrade v5.3.1 root fedora-current (push) Blocked by required conditions
ci / upgrade v5.6.2 root fedora-current (push) Blocked by required conditions
ci / machine linux amd64 (push) Blocked by required conditions
ci / windows unit (push) Blocked by required conditions
ci / windows e2e (push) Blocked by required conditions
ci / windows machine hyperv (push) Blocked by required conditions
ci / windows machine wsl (push) Blocked by required conditions
ci / macos machine applehv (push) Blocked by required conditions
ci / macos machine libkrun (push) Blocked by required conditions
ci / Total Success (push) Blocked by required conditions
zizmor: GitHub Actions Security Analysis / Zizmor (push) Waiting to run
libpod: do not fail prune when build container is already gone
2026-08-14 11:09:35 -04:00
nXtCyberNet
f76d9de01a added errorlint
Fixes: #29488
Signed-off-by: nXtCyberNet <rohantech2005@gmail.com>
2026-08-14 01:35:03 +05:30
Harsha Vardhan
a5db5be386 events: fix goroutine leak when using --until with dropped contexts
When fetching events with the --until flag on a system using the file events
backend, libpod/events/logfile.go spawned an unmanaged goroutine running
time.Sleep(time.Until(untilTime)). Because time.Sleep is not context-aware,
if a client cancelled the request or dropped the connection, the goroutine
remained sleeping in the background for the full until duration.

Fix this by using time.NewTimer and selecting on ctx.Done() so the background
goroutine exits immediately when the context is cancelled.

Fixes: #29491
Signed-off-by: Harsha Vardhan <harshahvk2005@gmail.com>
2026-08-13 19:45:46 +05:30
Paul Holzinger
cc762db629
libpod: implement force_port_listen containers.conf option
While we do not want to use listen() by default for bound ports it seems
it is needed in some special cases such as WSL, see
https://github.com/podman-container-tools/podman/issues/29377

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-08-12 11:21:39 +02:00
Paul Holzinger
e2f6336987
Merge pull request #29416 from AftAb-25/fix/events-log-rotation-byte-size-calc
events: fix logNeedsRotation to measure content size in bytes instead of runes
2026-08-11 18:27:55 +02:00
Aftab Ali
8966e6f796 events: fix logNeedsRotation to measure content size in bytes not runes
file.Size() returns bytes, so the comparison in logNeedsRotation must also
use bytes. The old code used len([]rune(content)) (rune/character count)
which undercounts multi-byte UTF-8 characters and allows the event log to
grow past events_logfile_max_size.

Replace with len(content)+1 (byte count, including the trailing newline
appended by writeToFile) so the size estimate is consistent with file.Size().

Add a regression test with multi-byte UTF-8 content to prevent regressions.

Also, explicitly close temp files before size rotation checks to fix
macOS/Lima CI failures caused by file locking and stat caching.

Fixes: #29414
Signed-off-by: Aftab Ali <aftab123215@gmail.com>
2026-08-11 19:49:24 +05:30
Giuseppe Scrivano
dca4659f9e
Merge pull request #29432 from shrevid03/fix/events-logfile-use-filepath
libpod/events: use filepath.Dir for filesystem path
2026-08-11 16:13:30 +02:00
Satwik Sai Prakash Sahoo
05929acd90
swagger: fix deprecated alias annotations and model name collisions
Replace deprecated swagger:alias with swagger:model for ImagePullStatus
and ArtifactPullStatus. Add explicit swagger:model annotations with
unique names to Podman types that collide with vendor types
(DriverData, PruneReport, RootFS, Secret, ThrottleDevice, WeightDevice,
Version) to resolve colliding model name warnings from go-swagger.

The types from libpod/define use a Libpod prefix, matching LibpodInfo
which already does that. Apart from the prefix the names are the ones
go-swagger derives on its own, so the annotations mostly just make the
naming explicit so the tool stops warning about it.

This does not close #29199 entirely. The two remaining name collisions
(Mount and Summary) are each between two vendored types, so they cannot
be controlled from the Podman side, and the dropped-ref-sibling
warnings are a separate problem.

Related: #29199
Signed-off-by: Satwik Sai Prakash Sahoo <sahoospsatwik@gmail.com>
2026-08-10 22:14:47 +05:30
Shreya Vidyadhar
f03c385dcd libpod/events: use filepath.Dir for consistency in truncate()
The truncate() function in libpod/events/logfile.go used path.Dir on a filesystem path (filePath). The file is Linux/FreeBSD only per its build tag, so this isn't about Windows correctness — it's about internal consistency: the same file already calls filepath.Dir at line 32 for the same kind of path handling, and filepath is idiomatic for filesystem operations.

Also removes the now-unused 'path' import.

Fixes part of #25165

Signed-off-by: Shreya Vidyadhar <shrevidh03@gmail.com>
2026-08-10 19:55:36 +05:30
Riccardo Paolo Bestetti
020e02d4a6
return usernsmode=private for created containers with userns=auto
Signed-off-by: Riccardo Paolo Bestetti <pbl@bestov.io>
2026-08-10 14:30:43 +02:00
Matt Heon
7b5ea1a367
Merge pull request #29324 from sudo-muneeb/fix-conmon-context-leak
libpod: propagate request context in HTTPAttach to prevent leak
2026-08-05 05:48:20 -04:00
Brent Baude
80bf6e6a10
Merge pull request #29227 from ashley-cui/dnsnames
Add dnsnames field & fix alias field
2026-08-04 08:49:33 -05:00
Ashley Cui
d05eddd683 Add dnsnames field & fix alias field
Docker now reserves alias specfically for user-defined aliases, and uses another field, dnsnames, to hold all aliases, including container ID and name.
Part of docker v1.45 compat work, but this touches the cli too, since they updated it there too.

Signed-off-by: Ashley Cui <acui@redhat.com>
2026-08-03 16:19:14 -04:00
Tushar Verma
95020c575d libpod: do not fail prune when build container is already gone
PruneBuildContainers() iterates over the snapshot returned by
store.Containers(). A build that was killed cleans up its own stage
containers in the background, which is exactly the situation this
function is meant to run after, so a container can disappear between the
snapshot and the calls that act on it.

When that happened ContainerDirectory() aborted the whole prune with a
hard return, and DeleteContainer() recorded "identifier is not a
container" in the report, which made podman system prune --build exit
125 even though the containers were gone.

Pruning wants the container gone, so treat ErrContainerUnknown and
ErrNotAContainer as success instead.

Seen in #28868, though that flake is really about the server side build
not stopping when the remote client is killed.

Signed-off-by: Tushar Verma <tusharmyself06@gmail.com>
2026-07-29 20:28:50 +05:30
Lokesh Mandvekar
30234265b2
Merge pull request #29242 from Honny1/pesto-addtional-tests
Add pesto port forwarding with source IP preservation
2026-07-29 10:29:40 -04:00
Sheikh Muneeb Ahmed
54ed0966b0 libpod: propagate request context in HTTPAttach to prevent leak
Fixes: #29323
Signed-off-by: Sheikh Muneeb Ahmed <msheikh.bsai24seecs@seecs.edu.pk>
2026-07-29 15:20:42 +05:00
Paul Holzinger
2b5572b0a6
libpod: unset network state in reloadContainerNetwork
Ensure we set the network status to nil after the teardown and save it
to the db. This is needed on network reload as the setup reads the
existing status for the pesto forwarding logic.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-07-28 18:52:27 +02:00
Jan Rodák
756732974b
Move pesto port forwarding to container-libs and vendor container-libs
This makes use of the new pasta integration code in container-libs.

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-07-28 18:29:52 +02:00
Sheikh Muneeb Ahmed
b0634a4eea libpod: use %w instead of %v in fmt.Errorf calls
Errors returned in the healthcheck timer path and events inspect data were formatted with %v, discarding the error chain. Replaced with %w so callers can use errors.Is/errors.As to inspect the underlying causes.

Signed-off-by: Sheikh Muneeb Ahmed <msheikh.bsai24seecs@seecs.edu.pk>
2026-07-28 18:42:22 +05:00
Jiwoo Ahn
f85047302c libpod: cleanup after failed container init
Fixes: #26143

Signed-off-by: Jiwoo Ahn <ikwydls1314@gmail.com>
2026-07-23 22:42:14 +09:00
Evzen Gasta
a19b696de1 feat(info): add memAvailable to host info
Expose MemAvailable alongside MemFree/MemTotal in `podman info` host
section, sourced from libpod/define/info.go's MemInfo.

Fixes: #29116 https://github.com/podman-container-tools/podman/issues/29116

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Evzen Gasta <evzen.ml@seznam.cz>

test(info): add coverage for host.memAvailable

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Evzen Gasta <evzen.ml@seznam.cz>
2026-07-22 08:41:59 +02:00
Danish Prakash
5561e6c416
Merge pull request #29168 from Honny1/fix-json-format
Fix inspect template `.HostIp` for Docker compatibility
2026-07-14 13:38:30 +05:30
Jan Rodák
030b0be9d8
Add HostIp() method to InspectHostPort for Docker template compat
Docker-compatible inspect templates using `{{.HostIp}}` fail in Podman
because Go templates resolve by struct field name (`HostIP`), not JSON
tag (`HostIp`). Add a `HostIp()` method so both notations work.

Note: this does not address the struct-vs-map difference that prevents
`range` over individual port bindings (would require an API break).

Relates: https://github.com/podman-container-tools/podman/issues/29164

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-07-13 16:08:11 +02:00
Jan Rodák
7ac3e83707
Fix duplicated command in inspect Args when container has single-element command
Fixes: https://github.com/podman-container-tools/podman/issues/29155

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-07-09 17:31:21 +02:00
Jan Rodák
7ab215c0be
Vendor container-libs with PestoSocketPath interface method
- go.podman.io/storage@main
- go.podman.io/image/v5@main
- go.podman.io/common@main

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

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-07-07 17:56:03 +02:00
Jan Rodák
e852389e55
Merge pull request #29071 from Luap99/scannererr
fix missing error checks for bufio.Scanner
2026-07-02 14:55:12 +02:00
Paul Holzinger
b4aaaee306
podman log-level debug must produce the same oci runtime errors
I do not understand this condition in the code, not passing the log file
to the runtime when run with log level debug makes no sense. It means we
do not get the proper error message from the runtime so debug logging
shows a much worse error:
"container create failed (no logs from conmon)..."

When the actual error is the command is not in $PATH for example. So to
fix this just remove the log level check. Also not the support json flag
condition is done inside execOCILog().

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-06-30 13:02:57 +02:00
Paul Holzinger
278068ef18
fix some missing scanner error checks
Found by scannererr:
https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/scannererr

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-06-30 10:32:32 +02:00
Marek Simek
e353bab7f5
fix: Handle healthcheck log corruption gracefully
The healthcheck log could be corrupted if the
process was interrupted mid-write. It could
lead to Podman crashing.

Write the log files atomically and diferentiate
between corrupted log and different errors in
consumers of readFromFileHealthCheckLog().
Add a system test for a corrupted log file.
Change incorrect log permissions to 0o600.

Fixes: https://redhat.atlassian.net/browse/RHEL-178222
Signed-off-by: Marek Simek <msimek@redhat.com>
2026-06-29 13:03:47 +02:00
Jan Rodák
60e90c14ec
Merge pull request #28664 from givensuman/fix/generate-kube-healthcheck
Export container healthcheck as LivenessProbe in generate kube
2026-06-25 17:32:57 +02:00
Danish Prakash
de3341fd81
Merge pull request #28977 from jiwahn/fix-kube-oci-annotation-roundtrip
Some checks are pending
ci / sys local root fedora-prior (push) Blocked by required conditions
ci / int local rootless fedora-prior (push) Blocked by required conditions
ci / sys local rootless fedora-prior (push) Blocked by required conditions
ci / int remote root fedora-prior (push) Blocked by required conditions
ci / sys remote root fedora-prior (push) Blocked by required conditions
ci / int local root fedora-rawhide (push) Blocked by required conditions
ci / sys local root fedora-rawhide (push) Blocked by required conditions
ci / int local rootless fedora-rawhide (push) Blocked by required conditions
ci / sys local rootless fedora-rawhide (push) Blocked by required conditions
ci / int remote root fedora-rawhide (push) Blocked by required conditions
ci / sys remote root fedora-rawhide (push) Blocked by required conditions
ci / apiv2 root fedora-current (push) Blocked by required conditions
ci / bindings root fedora-current (push) Blocked by required conditions
ci / compose_v2 root fedora-current (push) Blocked by required conditions
ci / docker_py root fedora-current (push) Blocked by required conditions
ci / unit root fedora-current (push) Blocked by required conditions
ci / apiv2 rootless fedora-current (push) Blocked by required conditions
ci / compose_v2 rootless fedora-current (push) Blocked by required conditions
ci / unit rootless fedora-current (push) Blocked by required conditions
ci / upgrade v5.3.1 root fedora-current (push) Blocked by required conditions
ci / upgrade v5.6.2 root fedora-current (push) Blocked by required conditions
ci / machine linux amd64 (push) Blocked by required conditions
ci / windows unit (push) Blocked by required conditions
ci / windows e2e (push) Blocked by required conditions
ci / windows machine hyperv (push) Blocked by required conditions
ci / windows machine wsl (push) Blocked by required conditions
ci / macos machine applehv (push) Blocked by required conditions
ci / macos machine libkrun (push) Blocked by required conditions
ci / Total Success (push) Blocked by required conditions
zizmor: GitHub Actions Security Analysis / Zizmor (push) Waiting to run
kube: alias OCI runtime annotations without underscores
2026-06-24 20:29:15 +05:30
Matt Heon
cbdb3126e9
Merge pull request #29016 from Luap99/exec-cleanup
fix cleanupExecBundle locking and some more exec releated cleanups
2026-06-24 09:46:40 -04:00