Commit Graph

7272 Commits

Author SHA1 Message Date
Tom Sweeney
12c656234c Merge pull request #28430 from Honny1/fix-containerignore
Fix .containerignore patterns with leading/trailing slashes
2026-04-03 17:32:29 -04:00
Paul Holzinger
d20933df02 add missing O_CLOEXEC to open calls
The go std os package to will always make sure to use O_CLOEXEC, however
in cases where we directly call unix.Open() we need to pass that flag
explicitly.

I looked at this as there was a report of a leaked fd on the pasta list,
though I am not sure this will address it.

But anyway doing this should be rather safe and avoid leaks into other
processes.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-04-02 15:06:37 +02:00
Jan Rodák
c57f9f49a3 Fix .containerignore patterns with leading/trailing slashes
Fixes: https://github.com/containers/podman/issues/25458

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-04-01 20:19:37 +02:00
Matt Heon
75d68ea174 Merge pull request #28414 from Honny1/fix-quadlet-lookup-strip
Fix Quadlet `Lookup()` stripping unmatched quotes
2026-03-31 11:14:47 -04:00
Jan Rodák
66c4c9c6b5 Merge pull request #28390 from crawfordxx/fix-docker-compat-stopped-state-28359
compat: map internal states to Docker equivalents in LibpodToContainer
2026-03-31 11:59:23 +02:00
Jan Rodák
cf6404f387 Fix Quadlet Lookup() stripping unmatched quotes
Fixes: https://github.com/containers/podman/issues/28409

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-03-31 10:27:39 +02:00
Matt Heon
9bea6e759a Merge pull request #28382 from himgov/issue/28369
Add a Status filter to podman quadlet list #28369
2026-03-30 13:25:04 -04:00
Joe Doss
667f55c2ce Fix shell driver DriverOpts cross-contamination in secret creation
When creating a secret with driver=shell via the API, the file driver's
default DriverOpts (including path) were applied because DriverOpts was
empty. The shell driver rejects path as an unknown option, making it
impossible to create shell-driver secrets via the REST API or
podman-remote.

Only apply default DriverOpts from config when the requested driver
matches the configured default driver.

Signed-off-by: Joe Doss <joe@solidadmin.com>
2026-03-30 00:56:45 -05:00
crawfordxx
fdf663b079 compat: map internal states to Docker equivalents in LibpodToContainer
The Docker compat /containers/json endpoint was leaking podman-internal
container states ("stopped", "stopping") that are not valid Docker API
states. Docker clients that strictly validate the State field against
the documented set ("created", "running", "paused", "restarting",
"exited", "removing", "dead") would fail with deserialization errors.

LibpodToContainerJSON already performs this mapping correctly:
- "stopped" → "exited"
- "stopping" → "running"

Apply the same remapping in LibpodToContainer using a switch statement
so the list endpoint behaves consistently with the inspect endpoint.

Add a test assertion to the compat /containers/json test to verify
that a stopped container is reported with State="exited".

Fixes #28359

Signed-off-by: crawfordxx <crawfordxx@users.noreply.github.com>
2026-03-29 12:04:46 +08:00
Himanshu Jaiswal
04935fe867 Add a Status filter to podman quadlet list
Adds --filter status=<value> support to podman quadlet list.
Also adds shell completion for the status filter values.

Signed-off-by: Himanshu Jaiswal <himanshu.bw5@gmail.com>
2026-03-28 12:05:46 +00:00
EDuToit
e58ec4dc07 Address seccomp profile todo:
- resolve seccomp profile from config default
- assign profile if default path is not defined

Signed-off-by: EDuToit <eben.dutoit07@gmail.com>
2026-03-26 12:00:59 +01:00
Tom Sweeney
8c3af49bef Merge pull request #28347 from Honny1/machine-cpu-limits
Reject `--cpus` above host CPU count on podman machine init and set
2026-03-25 11:05:37 -04:00
Jan Rodák
7952067882 Merge pull request #28352 from crawfordxx/fix-system-check-missing-return-on-parse-error
api: fix missing return after error in SystemCheck handler
2026-03-25 15:15:29 +01:00
Paul Holzinger
07aa62f82f Merge pull request #28232 from nickjwhite/distro-user-dir
Look for rootless quadlets in /usr/share/containers/systemd/users
2026-03-24 13:28:09 +01:00
Paul Holzinger
fb3bd08882 Merge pull request #28034 from baude/oswslerror
Error on WSL machine os apply|upgrade
2026-03-24 13:17:50 +01:00
Jan Rodák
5260bd37b6 Merge pull request #28224 from simonbrauner/libpod-pull-progress
Extend libpod pull API to show pull progress
2026-03-24 10:43:32 +01:00
crawfordxx
29d80a26af api: fix missing return after error in SystemCheck handler
In the SystemCheck HTTP handler, when parsing the
unreferenced_layer_max_age query parameter fails, the error response is
sent but execution continues to `unreferencedLayerMaximumAge = &duration`
where `duration` is the zero value. This causes the system check to run
with a zero duration instead of returning the 400 error to the client.

Add the missing `return` after the error response.

Fixes #28350

Signed-off-by: crawfordxx <crawfordxx@users.noreply.github.com>
2026-03-24 12:12:19 +08:00
Jan Rodák
bb4dda4855 Reject --cpus above host CPU count on podman machine init and set
Fixes: https://github.com/containers/podman/issues/28322

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-03-23 18:22:14 +01:00
Brent Baude
48d36932e2 Error on WSL machine os apply|upgrade
Given that apply and upgrade do not work on WSL, we should error out
with an error as such.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2026-03-23 10:01:53 -05:00
Danish Prakash
acd5f94d84 specgenutil: remove special handling of 0.0.0.0 for netavark
Podman strips `0.0.0.0` to `""` because netavark handles both
of them differently. With `""` netavark binds dual stack, same as
docker.

Signed-off-by: Danish Prakash <contact@danishpraka.sh>
2026-03-20 13:54:50 +05:30
Danish Prakash
9565002257 feat: add support for changing default host IPs via containers.conf
Add support for `default_host_ips` in containers.conf to set default
host IP(s) if no IP is set when forwarding ports. Multiple IPs can be
configured, and passing explicit IP with -p will always override
the configured defaults.

Signed-off-by: Danish Prakash <contact@danishpraka.sh>
2026-03-20 13:54:48 +05:30
Paul Holzinger
0147339e8e Merge pull request #28202 from lsm5/podman6-no-cni-vendor
Podman6: Vendor update w/o CNI + additional cleanups
2026-03-19 21:44:01 +01:00
Paul Holzinger
46502be750 Merge pull request #28234 from Honny1/add-format-for-scp
Add `--format` to `podman image scp`
2026-03-19 19:50:16 +01:00
Paul Holzinger
5d7bc4e947 Merge pull request #28323 from giuseppe/detect-stale-pause-process
rootless: detect and remove stale pause.pid with recycled PIDs
2026-03-19 18:33:53 +01:00
Paul Holzinger
d2e7e8192e Merge pull request #28235 from Honny1/volume-prune-docker
`podman volume prune`: match Docker defaults, add `--all` flag
2026-03-19 17:53:18 +01:00
Jan Rodák
da3c4aa21a Add --format to image scp
Add --format (oci-archive, docker-archive) to pass through to podman save.
Default is unchanged (no --format) so podman save uses its own default.
Document that scp is not storage-to-storage and only archive formats
are supported.

Fixes: https://github.com/containers/podman/issues/28183
Fixes: https://issues.redhat.com/browse/RUN-4403

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-03-19 17:42:33 +01:00
Lokesh Mandvekar
7d50844922 test: remove CNI_CONFIG_DIR env var handling
The CNI_CONFIG_DIR environment variable is no longer relevant now
that CNI support has been removed.

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2026-03-19 20:26:21 +05:30
Tom Sweeney
bb9d188d4a Merge pull request #28236 from Honny1/fix-unless-stopped
Fix `unless-stopped` containers not restarting after `podman-restart-service` stop them
2026-03-19 10:45:28 -04:00
Giuseppe Scrivano
a2db18f35c rootless: detect and remove stale pause.pid with recycled PIDs
When a pause process dies and its PID gets recycled by an unrelated
process, the stale pause.pid file causes join failures.  Detect this
by checking /proc/<pid>/environ for _PODMAN_PAUSE=1 after a failed
join attempt.

Closes: https://github.com/containers/podman/issues/28157

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2026-03-19 14:46:29 +01:00
Jan Rodák
d887a8146a Fix creating unnamed volumes as anonymous
Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-03-19 13:40:47 +01:00
Jan Rodák
339acf880c volume prune: match Docker default and add --all
Fixes: https://github.com/containers/podman/issues/24597
Fixes: https://issues.redhat.com/browse/RUN-4404

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-03-19 13:40:45 +01:00
Matt Heon
5a40e02c81 Merge pull request #27980 from amyssnippet/fix/27977
fix(quadlet): correct replace behavior and prevent duplicates in .app files
2026-03-18 14:24:38 -04:00
Šimon Brauner
6f497d2437 Extend libpod pull API to show pull progress
Fixes: https://issues.redhat.com/browse/RUN-4362

Signed-off-by: Šimon Brauner <sbrauner@redhat.com>
2026-03-18 13:44:41 +01:00
Jan Rodák
7326b862e3 Fix unless-stopped containers not restarting after podman-restart.service stop them
When `podman-restart.service` stops containers, it marks them as "stopped by
user" which breaks the `unless-stopped` restart policy. Add hidden
`--not-stopped-by-user` flag to prevent this, allowing `unless-stopped`
containers to restart on next boot.

Fixes: https://github.com/containers/podman/issues/28152
Fixes: https://issues.redhat.com/browse/RUN-4357

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-03-16 13:51:17 +01:00
Jan Rodák
acf6472f5b Ignore operational EndpointSettings.IPAddress for static IPs in compat API
Docker treats EndpointSettings.IPAddress as operational/state, not desired create input.
Static address requests should come from IPAMConfig fields. Using both can duplicate
the same IPv4 request and trigger already allocated IPAM errors in compose scenarios.

Ref: moby/moby#46183 (daemon validation), docker/cli#4493 (CLI IPAMConfig), moby/moby#19001 (static IP feature).

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-03-16 13:48:41 +01:00
Lokesh Mandvekar
03f0b70b28 Merge pull request #28286 from com6056/fix-container-create-409
compat: return 409 Conflict when container name is already in use
2026-03-16 16:44:35 +05:30
Jordan Rodgers
7ecac4a65e compat: return 409 Conflict when container name is already in use
The Docker API spec defines HTTP 409 for POST /containers/create when
the requested name is already in use. The handler was returning 500 for
all errors from ContainerCreate, including ErrCtrExists.

This mismatch breaks buildx parallel builds on Podman: buildx checks
for a conflict response to safely converge multiple concurrent builders
onto the already-running BuildKit container. With 500 it treats the
conflict as a fatal error instead, causing all but the first parallel
build to fail.

The fix follows the same pattern already used in the rename handler,
which correctly returns 409 for ErrCtrExists. The swagger annotation
for this endpoint already documents the 409 response.

Signed-off-by: Jordan Rodgers <com6056@gmail.com>
2026-03-13 09:53:04 -07:00
Matt Heon
f43504a329 Merge pull request #28279 from umut-polat/fix-quadlet-empty-entrypoint
quadlet: allow empty Entrypoint to clear image default
2026-03-13 09:20:06 -04:00
umut-polat
926f562bd5 quadlet: allow empty Entrypoint to clear image default
Setting Entrypoint= (empty value) in a quadlet .container file should
produce --entrypoint "" in the generated podman command, which clears
the image's default entrypoint. Previously this was silently ignored
because lookupAndAddString skips empty values.

Move the Entrypoint key out of the generic stringKeys map and handle
it separately so that an empty value is passed through.

Closes #28213

Signed-off-by: umut-polat <52835619+umut-polat@users.noreply.github.com>
2026-03-13 08:14:57 +00:00
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
Nick White
1aadae04af Look for rootless quadlets in /usr/share/containers/systemd/users
This is a useful place for packagers to put quadlets which they want
to make available for all users.

Fixes: #27843

Signed-off-by: Nick White <git@njw.name>
2026-03-10 20:00:22 +00: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