Commit Graph

4517 Commits

Author SHA1 Message Date
Miloslav Trmač
cb9df63d63 Fix compilation of tests without CGo
Have the build conditions match the build conditions of the
referenced implementation.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2026-03-03 21:30:05 +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č
d561f13d7c Simplify setting up Runtime.imageContext
- Don't allocate it on-demand, it will always be created in the end.
- Embed the SystemContext directly, without using a pointer,
  to make it clear it always exists.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2026-03-02 23:16:49 +01:00
Miloslav Trmač
2ac337dbd8 Behavior change: Don't change TMPDIR in WithRegistriesConf
Previously, using WithRegistriesConf was setting
BigFilesTemporaryDir using buildah/internal/tmpdir, which (turns relative
$TMPDIR into absolute and) silently ignores invalid values in containers.conf
and uses /var/tmp in that case.

Without WithRegistriesConf, we would first initialize libimage with
BigFilesTemporaryDir = nil (causing libimage to determine BigFilesTemporaryDir
using a _different_ code path which fails on invalid containers.conf),
and only later set r.imageContext.BigFilesTemporaryDir.

It doesn't make sense that --registries-conf should affect TMPDIR processing
that way, and presumably the code path without --registries-conf is much
more frequently used and the one everyone expects; so drop this aspect of
WithRegistriesConf.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2026-03-02 23:06:53 +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
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
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
02f0766a79 update golangci-lint to v2.10.1
And remove one false positive comment that got fixed as it seems like.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-02-23 10:13:48 +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
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
Matt Heon
7e78e842a0 Merge pull request #28076 from amyssnippet/fix-final-v3
inspect: preserve secret target name in env masking
2026-02-17 12:09:32 -05:00
Amol Yadav
ed8eec6bbf using Debugf and removed wierd DEBUG logs
Signed-off-by: Amol Yadav <amyssnipet@yahoo.com>
2026-02-17 13:58:22 +05:30
Paul Holzinger
60cfb66d8f podman system reset: do not print storage.conf warning
The orginal motivation was to give a hint to users to delete the file if
they did not create the storage.conf file since some early versions of
podman did auto generate that file[1].

However that was a really long time ago and with the config file rework
there can be many different storage.conf paths so this warning is no
longer useful so we should be able to remove this now.

[1] https://github.com/containers/podman/issues/7447

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-02-16 13:47:56 +01:00
Paul Holzinger
0778bdaffe podman info: remove storage.conf path
Given the new config file logic will read many files pritning one
specific one here has no meaning anymore, just delete it.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-02-16 13:47:56 +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
Amol Yadav
e9ba515fcf Add debug logging for EnvSecrets to diagnose restart mapping issue
Signed-off-by: Amol Yadav <amyssnipet@yahoo.com>
2026-02-13 22:44:52 +05:30
Amol Yadav
ac7d6c3fc4 inspect: preserve secret target name in env masking
Fixes #28075

Signed-off-by: Amol Yadav <amyssnipet@yahoo.com>
2026-02-13 22:43:14 +05:30
Kir Kolyshkin
24a04de921 libpod: fix build
In the currently used go.podman.io/common/pkg/libartifact version
there is no store subpackage (yet). Fix the import statement and
usage accordingly.

Fixes: df0e3b6ec7 ("libpod: move artifact volume validation to creation phase"
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-02-12 17:30:07 -08:00
Paul Holzinger
89b646d8a3 Merge pull request #27946 from kairosci/fix/27747-artifact-volume-validation
libpod: move artifact volume validation to creation phase
2026-02-12 20:22:32 +01: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
Alessio Attilio
df0e3b6ec7 libpod: validate artifact volume on create
Fixes: #27747
Signed-off-by: Alessio Attilio <attilio.alessio@protonmail.com>
2026-02-12 18:24:16 +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
0ba42fe487 ci: bump golangci-lint to v2.9.0
Apparently, prealloc got much smarter in this version, so let's disable
it for _test.go files as we're not really interested in
micro-optimizations for the test code.

The rest of its warnings is being fixed by the earlier commits.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-02-11 11:41:11 -08:00
Kir Kolyshkin
3c3d32718f libpod: do not reuse names slice
Do not reuse names slice for the unrelated data. This fixes the
following prealoc warning:

> libpod/storage.go:109:2: Consider preallocating names with capacity 2 (prealloc)
> 	names := []string{containerName}
> 	^

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
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
Patrick Wicki
2828965a75 healthcheck_linux: avoid failing transient units
The main purpose of the transient services/timers is to trigger the
healthcheck execution in regular intervals, their own state should
not depend on the result of the healthchecks. This way there are no
failing systemd services unless there is actually a fatal error.

Signed-off-by: Patrick Wicki <patrick.wicki@siemens.com>
2026-02-09 19:52:29 +01:00
Kir Kolyshkin
49cce3ec16 libpod: modernize state test
Use t.Helper, t.TempDir, and t.Cleanup in getEmptySqliteState,
simplifying its code and its users.

Simplify runForAllStates: remove redundant t.Fail call, and move
getEmptySqliteState call under t.Run.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-02-07 12:11:47 -08:00
Paul Holzinger
ff7406b733 Merge pull request #27927 from kairosci/fix/27823-host-gateway-localhost
fix: use localhost for host.containers.internal in host network mode
2026-02-03 20:08:43 +01:00
SanjayReddy91
82e04e8d7f fix: prevent race condition during database initialization by using INSERT OR IGNORE.
Signed-off-by: SanjayReddy91 <gamerzdamnyt1234@gmail.com>

test: add test to check if SQLite DB config change will mitigate race condition when multiple podman process start at once.

Signed-off-by: SanjayReddy91 <gamerzdamnyt1234@gmail.com>

test: Check to ensure only one row was created in DBConfig table.

Signed-off-by: SanjayReddy91 <gamerzdamnyt1234@gmail.com>

test: Changed no of processes started at once to 20.

Signed-off-by: SanjayReddy91 <gamerzdamnyt1234@gmail.com>

test: rc reset to 0 to not affect second part of the test, db path is no longer hardcoded in test case.

Signed-off-by: SanjayReddy91 <gamerzdamnyt1234@gmail.com>

test: Reverted test case.

Signed-off-by: SanjayReddy91 <gamerzdamnyt1234@gmail.com>

lint: removed trailing whitespaces.

Signed-off-by: SanjayReddy91 <gamerzdamnyt1234@gmail.com>
2026-02-03 22:47:09 +05:30
Alessio Attilio
fae93fe483 fix: use localhost for host.containers.internal in host network mode
Signed-off-by: Alessio Attilio <attilio.alessio@protonmail.com>
2026-02-03 18:00:51 +01:00
Paul Holzinger
19aba793c0 remove dep on github.com/containers/conmon
We use only for a single const so inline that and use a better variable
name.

The main reason is the latest version of conmon removed that go code so
the update of it will be broken.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-01-30 12:51:50 +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
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
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
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
Alessio Attilio
6c1d8f5d76 libpod: fix Volume.Mount() returning empty path for plugin volumes
Fixes: #27858
Signed-off-by: Alessio Attilio <attilio.alessio@protonmail.com>
2026-01-19 14:54:27 +01: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
Brent Baude
75ab2006a2 Merge pull request #27891 from caxu-rh/libpod-simplify
libpod: simplify unnecessary loops
2026-01-15 10:35:37 -06:00
Brent Baude
94cf4e314b Merge pull request #27730 from inknos/delete-quadlet-api
Add DELETE /libpod/quadlets
2026-01-15 09:43:37 -06: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
shiavm006
231dbdf5b3 Fix container export emitting incorrect event type.
Signed-off-by: shiavm006 <shivammittal42006@gmail.com>
2026-01-12 16:25:25 +05:30
Caleb Xu
f6e3200f40 libpod: simplify unnecessary loops
Signed-off-by: Caleb Xu <caxu@redhat.com>
2026-01-09 16:49:33 -05:00
Jason Oh
86799cb2cb Fixes #27651 - Fix health inspect/ps for rootfs containers with empty healthcheck
Signed-off-by: Jason Oh <jasonoh@utexas.edu>
2026-01-07 12:18:01 -06: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