4467 Commits

Author SHA1 Message Date
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
Paul Holzinger
8d0ecd4d84 Merge pull request #27330 from winterqt/push-pwouqluolwxt
libpod: fix healthchecks not executing every interval on linux
2025-12-12 18:15:05 +01:00
Paul Holzinger
2608feb4f7 Merge pull request #27708 from anagno/fix/probe
fix: skip execution of probes when initialDelaySeconds is not elapsed
2025-12-11 15:35:06 +01:00
Vasileios Anagnostopoulos
88bacfc133 fix: skip execution of probes when initialDelaySeconds is not elapsed
According to the [Kubernetes docs](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#configure-probes)
the probes should be executed after the `initialDelaySeconds`. So to be
consistent with the kubernetes specs, skip the execution of the probes until
the `initialDelaySeconds` is elapsed.

Closes #27678

Signed-off-by: Vasileios Anagnostopoulos <anagnwstopoulos@hotmail.com>
2025-12-11 12:50:24 +01:00
Brent Baude
f348a0717d Vendor latest mono repo for libartifact changes
This PR vendors in the strong typed libartifact code and carries the
associated changes.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-12-10 14:44:50 -06:00
Matt Heon
a8ecb80ac0 Deterministically order pod inspect fields
There are two fields I'm worried about: shared namespaces and pod
containers. Both are generated via loops over maps and are thus
non-deterministic in ordering. Throw a sort on each to fix the
order so we can actually diff `podman pod inspect` output.

Signed-off-by: Matt Heon <mheon@redhat.com>
2025-12-04 15:25:11 -05:00
openshift-merge-bot[bot]
244aa643c7 Merge pull request #27672 from Luap99/workdir
libpod: fix workdir MkdirAll() all check
2025-12-04 15:52:35 +00:00
openshift-merge-bot[bot]
5508d873c1 Merge pull request #27619 from Honny1/fix-unless-stopped-reboot
Fix `unless-stopped` restart policy to match Docker behavior
2025-12-04 15:04:10 +00:00
Paul Holzinger
d18e44e9ab libpod: simplify resolveWorkDir()
The code checks for isPathOnVolume and isPathOnMount so we can just use
the SecureJoin here directly to check for path existance.

Then instead of walking symlinks and trying to guess if they are on a
mount just assume if it is a link (path is different from the normal
joined one) then don't error out early and let the OCI runtime deal with
it. The runtime does produce a less readable error but it still fails
and we have much less fragile code.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-12-04 15:25:49 +01:00
Paul Holzinger
7b1be7f177 libpod: fix workdir MkdirAll() all check
MkdirAll can fail with EEXIST when the path is a symlink and the target
doesn't exist. As such we should ignore the error.

Note there is something fundemantal wrong here with the path access as
it is following the symlink to the host, however it is only for a
stat() so it is not an security issue here.

Fixes: 637c264e2e ("fix issues found by nilness")

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-12-04 15:25:30 +01:00
Lokesh Mandvekar
b78f1cf986 vendor: update container-libs to df55d6c661e8 for cgv1 removal
Also simplifies cgroups.AvailableControllers

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2025-12-02 15:38:30 -05:00
Jan Rodák
4d3c6311a5 Fix unless-stopped restart policy to match Docker behavior
- Update documentation: Differentiate `unless-stopped` from `always` - containers stopped by the user before a reboot will not restart.
- Add `should-start-on-boot` filter: Identify containers that require a restart after a system reboot.
- Update command documentation: Add `restart-policy` and `label!` filters to the documentation for container commands (rm, ps, start, stop, pause, unpause, restart).
- Add `restart-policy` and `shoud-start-on-boot` to completions.
- Update service: Update `podman-restart.service` to use the `needs-restart=true` filter.
- Preserve state: Preserve the `StoppedByUser` state across reboots.
- Update API: Add a `ShouldStartOnBoot()` method to the Container API.
- Update documentation: Add descriptions for the `should-start-on-boot` filter.

Fixes: https://issues.redhat.com/browse/RHEL-129405
Fixes: https://github.com/containers/podman/issues/20418

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2025-12-02 15:40:46 +01:00
Winter M
ed6f63af10 libpod: fix healthchecks not executing every interval on linux
By default, systemd sets a limit of how many times a service can start,
which means that if you have a healthcheck that runs more often than the
limits, systemd will refuse to start it with a message like "Start request
repeated too quickly." emitted to the journal.

Signed-off-by: Winter M <winter@antithesis.com>
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-11-26 17:57:38 +01:00
Paul Holzinger
d163c38a26 vendor: update common, image, storage to main
This also then bumps github.com/opencontainers/runtime-spec to v1.3.0
which contains breaking changes of the pid type as such we had to update
all the podman callers.

And tags.cncf.io/container-device-interface also used some changed
types from it and they have been updated in main so bump to the latest
commit there as well in order to get podman to compile properly.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-11-21 14:24:29 +01:00
ryanmccann1024
61cbc0c3ee feat(exec): Add --no-session flag for improved performance
Fixes: #26588

For use cases like HPC, where `podman exec` is called in rapid succession, the standard exec process can become a bottleneck due to container locking and database I/O for session tracking.

This commit introduces a new `--no-session` flag to `podman exec`. When used, this flag invokes a new, lightweight backend implementation that:

- Skips container locking, reducing lock contention
- Bypasses the creation, tracking, and removal of exec sessions in the database
- Executes the command directly and retrieves the exit code without persisting session state
- Maintains consistency with regular exec for container lookup, TTY handling, and environment setup
- Shares implementation with health check execution to avoid code duplication

The implementation addresses all performance bottlenecks while preserving compatibility with existing exec functionality including --latest flag support and proper exit code handling.

Changes include:
- Add --no-session flag to cmd/podman/containers/exec.go
- Implement lightweight execution path in libpod/container_exec.go
- Ensure consistent container validation and environment setup
- Add comprehensive exit code testing including signal handling (exit 137)
- Optimize configuration to skip unnecessary exit command setup

Signed-off-by: Ryan McCann <ryan_mccann@student.uml.edu>
Signed-off-by: ryanmccann1024 <ryan_mccann@student.uml.edu>
2025-11-19 12:44:48 -05:00
openshift-merge-bot[bot]
af91cae1c5 Merge pull request #27271 from lsm5/podman6-no-cgv1
Podman6: Remove cgroupsv1
2025-11-14 17:03:59 +00:00
Nicola Sella
df4905d68b Remove hardcoded refs from ociartifact code
Fixes: https://issues.redhat.com/browse/RUN-3578

Signed-off-by: Nicola Sella <nsella@redhat.com>
2025-11-13 22:57:21 +01:00
Lokesh Mandvekar
96aba07d95 libpod/container_internal.go: util.SizeOfPath -> directory.Size
- Remove deprecated util.SizeOfPath

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2025-11-12 15:35:29 -05:00
Lokesh Mandvekar
f11392c719 Remove deprecated fields ctrConfig.[StaticIP,StaticMAC]
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2025-11-12 15:35:29 -05:00
Lokesh Mandvekar
a3fcf52a1c Fix deprecation notice to make gocritic happy.
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2025-11-12 15:35:29 -05:00
Lokesh Mandvekar
145540fed4 Remove ContainerStats.PerCPU: CGV1 only
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2025-11-12 15:15:34 -05:00
Lokesh Mandvekar
c98c50ec76 libpod/pod_api.go: Remove Cgroups v1
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2025-11-12 15:15:33 -05:00
Lokesh Mandvekar
06bc277ad8 libpod/util_linux.go: Remove Cgroups v1
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2025-11-12 15:15:33 -05:00
Lokesh Mandvekar
a12b3e97d2 libpod/runtime.go: Remove Cgroups v1
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2025-11-12 15:15:33 -05:00
Lokesh Mandvekar
faa551a921 libpod/runtime_ctr.go: Remove Cgroups v1
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2025-11-12 15:15:33 -05:00
Lokesh Mandvekar
cb91d90835 libpod/runtime_pod_linux.go: Remove Cgroups v1
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2025-11-12 15:15:32 -05:00
Lokesh Mandvekar
5499b79c8e libpod/runtime_linux.go: Remove Cgroups v1
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2025-11-12 15:15:32 -05:00
Lokesh Mandvekar
7c45f43a46 libpod/info_linux.go: Remove Cgroups v1
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2025-11-12 15:15:32 -05:00
Lokesh Mandvekar
4d404f1f1d libpod/container_internal*.go: Remove Cgroups v1
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2025-11-12 15:15:32 -05:00
Paul Holzinger
5c1ed12d8d enable gofumpt formatter
Based on our discussion gofumpt won the vote so use that one via
golangci-lint.

https://github.com/containers/podman/discussions/27291

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-11-11 12:32:46 +01:00
Paul Holzinger
a6f1c63c19 fix lint issues with github.com/cyphar/filepath-securejoin
The old location is deprecated and has been removed in v0.6.0 even. I
did this as extra commit to make cherry-picking easier.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-11-06 16:33:19 +01:00
Paul Holzinger
47ab0f1e94 update github.com/opencontainers/cgroups to v0.0.6
Includes one small fix for a breaking change in a type.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-11-06 14:39:04 +01:00
Matt Heon
f5bc2abe4c Remove BoltDB state support
This also includes a number of significant changes to the SQLite
state made possible by removal of the legacy DB.

1. Enable database unit tests for SQLite state, with numerous
   tweaks to get tests passing. Most notable changes are to
   container removal - where we previously didn't return an error
   if there was no container to remove - and RemovePodContainers,
   which I don't think ever worked properly from my reading of
   the failures.
2. Removal of AddContainerToPod/RemoveContainerToPod. On SQLite,
   these functions are identical to AddContainer/RemoveContainer
   and there is no reason to retain duplicates.
3. Removal of SafeRewriteContainerConfig - it's identical to
   RewriteContainerConfig in SQLite, no reason to have duplicate
   entrypoints.

As an exciting side-note, this removes Podman's requirement that
containers and pods cannot share a name, which was a BoltDB
restriction only.

Signed-off-by: Matt Heon <matthew.heon@pm.me>
2025-10-28 12:09:04 -04:00
Matt Heon
34166fc004 Bump Go version to v6
Tremendous amount of changes in here, but all should amount to
the same thing: changing Go import paths from v5 to v6.

Also bumped go.mod to github.com/containers/podman/v6 and updated
version to v6.0.0-dev.

Signed-off-by: Matt Heon <mheon@redhat.com>
2025-10-23 11:00:15 -04:00
Matt Heon
9ea18b78fa Warn on boltdb use
We started logging this in 5.6. In 5.7, we up to a warning. The
upcoming 5.8 will up the warnings further to errors.

Required as we're removing BoltDB support in 6.0 next Spring.

Signed-off-by: Matt Heon <matthew.heon@pm.me>
2025-10-22 09:24:43 -04:00
openshift-merge-bot[bot]
1a8eb18b2b Merge pull request #27310 from mheon/default-runtime-flags
Add support for runtime flags in containers.conf
2025-10-20 10:57:46 +00:00
Lokesh Mandvekar
74788a3fe1 fileperms: newer Go 1.13+ octal literal format
Problem: While removing cgroupsv1 code, I noticed my neovim Go config
automatically changed fileperms to the new octal format and I didn't
want that polluting my diffs.

Decision: I thought it best to switch to the new octal format in a dedicated PR.

Action:
- Cursor switched to new octal format for all fileperm ocurrences in Go
 source and test files.
- vendor/, docs/ and non-Go files were ignored.
- Reviewed manually.

Ref: https://go.dev/ref/spec#Go_1.13

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2025-10-16 14:11:29 -04:00
Rosvaldas Atstupėnas
0a20e22384 Add default runtime flags in config
Added a way to define default runtime flags in config.

Fixes: https://github.com/containers/common/issues/715

Default runtime flags should be defined as shown below:

[engine.runtimes_flags]
runsc = [
  "net-raw",
]

crun = [
  "debug",
]

Signed-off-by: Rosvaldas Atstupėnas <atstupenas.rosvaldas@gmail.com>
2025-10-16 13:51:46 -04:00
Brent Baude
cfd4cc0932 remove libartifact from podman
pkg/libartifact has been moved to common and as such needs to be removed
from podman and the new common vendored in along with required deps.

https://issues.redhat.com/browse/RUN-3618

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-10-16 09:55:59 -05:00
Matt Souza
090304a054 lint: reenable revive unused-parameter check
Signed-off-by: Matt Souza <medsouz99@gmail.com>
2025-10-01 10:42:08 -04:00
Mark Johnston
602ba415c6 libpod: Implement getOnlineCPUs() on FreeBSD
Include an explicit container state check.  Otherwise the
containers/stats endpoint will return all-zero stats for a stopped
container even when in non-streaming mode, which breaks some consumers
of the API, particularly nomad's podman driver.

Implement the interface by just returning the number of host CPUs.  A
bit more sophisticated would be to fetch the jail's cpuset, but it's not
very important for now.

Signed-off-by: Mark Johnston <mark.johnston@klarasystems.com>
2025-09-18 14:24:35 +00:00
Paul Holzinger
4417e6269c use maps.Clone() over Copy() when possible
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-09-10 16:17:05 +02:00
Paul Holzinger
637de6022f libpod/oci_conmon_linux.go: fix false postive in linter
staticcheck claims the var value is not used but we use it for the
mount.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-09-10 16:17:05 +02:00
Paul Holzinger
78e5a521b0 inline some conditionals
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-09-10 16:17:04 +02:00
Paul Holzinger
8631032556 run modernize -fix ./...
Using golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize

+ some manual cleanup in libpod/lock/shm/shm_lock_test.go as it
  generated an unused variable
+ restored one removed comment

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-09-10 16:17:04 +02:00
Paul Holzinger
dc5a791f58 use bytes.SplitSeq where possible
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-09-10 16:17:04 +02:00
Paul Holzinger
b97525a78d use strings.SplitSeq where possible
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-09-10 16:17:04 +02:00
openshift-merge-bot[bot]
2745c9e50e Merge pull request #26912 from markjdb/main
Fix several FreeBSD integration problems
2025-09-05 09:44:01 +00:00
Matthew Heon
2c6dadd724 Fix a locking bug in that could cause a double-unlock
The `cleanupExecBundle` function was only meant to be called on a
locked container, as it does some state mutation operations. It
also has a timed wait (if the directory is busy and can't be
removed yet, give it a few milliseconds) in which it deliberately
yields the lock to not block the container for that time.

The `healthCheckExec()` function calls `cleanupExecBundle` out of
a `defer` block. This is after the `defer c.lock.Unlock()` so it
fires afterwards when the function returns, so we're normally
fine - the container is still locked when our defer runs. The
problem is that `healthCheckExec()` also unlocks the container
during the expensive exec operation, and can actually fail and
return while not holding the lock - meaning our `defer` can fire
on an unlocked container, leading to a potential double unlock
in `cleanupExecBundle`.

We could, potentially, re-lock the container after the exec
occurs, but we're actually waiting for a `select` to trigger to
end the function, so that's not a good solution. Instead, just
re-lock (if necessary) in the defer, before invoking
`cleanupExecBundle()`. The `defer c.lock.Unlock()` will fire
right after and unlock after us.

Fixes #26968

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2025-09-03 10:19:37 -04:00
Mark Johnston
2acf5c0119 libpod: Fix the jailName helper
At one point, we created multiple jails per container in order to enable
network configuration from outside the container jail.  On FreeBSD 14.x
and later this is not necessary and there is only one jail per
container.  In this case, return the correct jail name.

Signed-off-by: Mark Johnston <mark.johnston@klarasystems.com>
2025-09-02 16:17:18 +00:00