1617 Commits

Author SHA1 Message Date
Tom Sweeney
8b1e46170b Adjust API calls for compression
Add the various compression API calls as created by @nalind in #28807

Signed-off-by: Tom Sweeney <tsweeney@redhat.com>
2026-05-29 09:10:50 -04:00
Nicola Sella
e59b9dae8f api/libpod: fix r_limits cleared on update
Returnin nil when input is empty, to skip rlimit replacement
when r_limits is not present in the request.

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

Signed-off-by: Nicola Sella <nsella@redhat.com>
2026-05-27 13:32:31 +02:00
Jan Rodák
5b98ee331f Merge pull request #28641 from jiwahn/feat/container-annotation-filter
Feat/container annotation filter
2026-05-26 12:00:40 +02:00
Jan Rodák
751f7c316d Merge pull request #28714 from christopherbii/main
Fix Missing HostConfig field from API response
2026-05-26 10:26:46 +02:00
Kir Kolyshkin
7f7b35356f Replace os.Is* error checks with errors.Is
Using os.Is{Exist,NotExist,Permission} checks is not recommended in the
new code (see official documentation). While using it in the existing
code is OK, it may still result in a subtle errors later (for a specific
example of that, see [1]).

Replace those with errors.Is.

Generated by:

	gofmt -r 'os.IsExist(a) -> errors.Is(a, os.ErrExist)' -w .
	gofmt -r 'os.IsNotExist(a) -> errors.Is(a, os.ErrNotExist)' -w .
	gofmt -r 'os.IsPermission(a) -> errors.Is(a, os.ErrPermission)' -w .
	goimports -w .
	git diff vendor test/tools/vendor | patch -p1 -R

[1]: https://github.com/opencontainers/runc/pull/5061
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-05-21 13:09:42 -07:00
Christopher Bii
a53c10ced0 compat API: populate HostConfig in container list response
- Populate the Docker-compatible container summary HostConfig from the
  container inspect data
- Remove the unused ContainerCreateConfig wrapper from the compat
  handler
- Add APIv2 test

Signed-off-by: Christopher Bii <christopherbii@hyub.org>
2026-05-20 03:27:14 -04:00
Matt Van Horn
f2a51888f3 docs(api): drop trailing slash on podman.io/community contact URL
The swagger spec generated from pkg/api/server/doc.go sets the contact
URL to https://podman.io/community/. That URL now returns 404, while
https://podman.io/community (no trailing slash) returns 200 and is what
the live site links to from its own navigation. Issue #28298 reports
the link as broken at the top of the rendered API reference, which is
where ReDoc surfaces the contact field.

Drop the trailing slash so the contact link in the generated swagger
spec resolves.

Signed-off-by: Matt Van Horn <mvanhorn@gmail.com>
2026-05-19 02:48:35 -07:00
Jan Rodák
517070e750 Merge pull request #28673 from kyounghunJang/feat/add-volume-prune-dry-run
volume prune: add dry-run support
2026-05-18 19:26:18 +02:00
KyounghoonJang
3d899a8c25 volume prune: add dry-run support
Add a --dry-run option to show which volumes would be pruned without removing them.

Related: #27838
Signed-off-by: KyounghoonJang <matkimchi_@naver.com>
2026-05-16 19:03:34 +09:00
Matthew Heon
3ac6501fdd API Handlers should not error on empty request bodies
This is a Docker compatibility change discovered while working on
cases it is practically speaking required because there are
mandatory parameters in the body, but in those cases you do not
get a JSON decode error back, you get an error about the field
that needs to be set. I see no reason for us not to match this
convention; it doesn't break our existing bindings, but makes
using the API via curl or similar somewhat easier.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2026-05-13 16:33:40 -04:00
nitz
b571943fe4 api: emit aux trailer with manifest digest on image push
The Docker daemon emits a final `{"aux":{"Tag","Digest","Size"}}` JSON
object on the push event stream so clients can recover the registry-side
manifest digest without an extra registry round-trip.

Several Docker-API clients (e.g. the Pulumi and Terraform docker
providers) parse `aux.Digest` to populate their pushed-image outputs.
Without the trailer they either silently fall back to inspecting the
local image (whose digest does not always match what was pushed - see
containers/podman#14779) or emit "Push completed without reporting a
digest" warnings.

`pushReport.ManifestDigest` is already populated with the correct
on-the-wire digest from `manifest.Digest(pushedManifestBytes)`; this
change just wraps it into the same JSON shape Docker emits and adds an
apiv2 test asserting the trailer is present with Tag, Digest, and Size.

Signed-off-by: nitz <nitz.raz@gmail.com>
2026-05-13 13:23:16 +03:00
Jiwoo Ahn
ec583fa17f filters: add annotation filter for containers Fixes: #28562
Signed-off-by: Jiwoo Ahn <ikwydls1314@gmail.com>
2026-05-11 20:24:28 +09:00
Lokesh Mandvekar
89efbf1dce pkg/api/grpcpb: auto-format generated protobuf files
Update build.sh to run gofumpt on generated .pb.go files, and apply
formatting to existing generated files. This fixes gofumpt and inamedparam
lint errors on macOS CI and ensures future regenerations will be
automatically formatted.

Signed-off-by: Lokesh Mandvekar <lsm5@linux.com>
2026-05-07 13:30:23 -04:00
Alessio Attilio
c4a4c7e117 API: Add Health field to compat ListContainers and restrict to v1.52+
Signed-off-by: Alessio Attilio <attilio.alessio@protonmail.com>
2026-04-23 08:39:43 +00:00
Brent Baude
2cc3be7332 RUN-4539: Change podman module paths
The podman module paths are moving from github.com/containers/podman to
go.podman.io/podman.  This will help with future mobility.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2026-04-22 14:02:25 -05:00
Brent Baude
2e6f29a2df RUN-4538: Fix buildah vendoring
This PR reflects the upstream change of moving the buildah module from
github.com/containers/buildah to go.podman.io/buildah.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2026-04-21 14:27:58 -05:00
Paul Holzinger
ff6fb6eb2d Merge pull request #28508 from jankaluza/configfile
trust: switch policy.json lookup to configfile
2026-04-21 12:04:43 +02:00
Matt Heon
98ca040cd7 Merge pull request #28536 from zhangguanzhang/fix-tmp
Clean up temporary file for CreateImageFromSrc
2026-04-20 18:19:20 -04:00
Jan Kaluza
cae4c40323 compat: limit err scope in CommitContainer.
Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2026-04-20 15:11:34 +02:00
Jan Kaluza
54d61c2f02 trust: switch policy.json lookup to configfile
Use shared configfile instead of custom policy.json path handling.
This updates ocipull to rely on signature.DefaultPolicy(), removes
explicit SignaturePolicyPath, and replaces trust's custom default-policy
path logic with common configfile code.

Replace hidden `--policypath` with --signature-policy` and require
it for `trust set` command instead of path resolution based on
configfile.

For `trust get`, the `--signature-policy` is optional.

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2026-04-20 15:11:22 +02:00
Jan Rodák
ecf493dea0 Fix Docker compat /wait hanging on fast-exiting containers
The Docker client (docker run) sends /wait then /start, but it only
sends /start after receiving the 200 OK response from /wait. Previously,
the event subscription for the "died" event was set up after the 200 was
sent, creating a window where a fast-exiting container (e.g. hello-world)
could emit its "died" event before the subscription was ready, causing
the client to hang forever.

Fix this by subscribing to "died" events before flushing the 200 status
code. This guarantees the event listener is ready before the client can
send /start, eliminating the race entirely.

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

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-04-20 15:01:42 +02:00
Paul Holzinger
34a4633d5f Merge pull request #28275 from mheon/ordered_networks
Move to deterministic network setup order
2026-04-20 12:33:13 +02:00
Jan Rodák
7534429ade Merge pull request #28524 from Luap99/isolate
remove isolate option from docker compat API
2026-04-20 10:03:27 +02:00
Jan Rodák
2fd0d2636c Merge pull request #28528 from inknos/pod-option-quadlet
Add Pod to quadlet list
2026-04-20 10:02:03 +02:00
zhangguanzhang
64f9059d2e Fixes: #28531 Clean up temporary file for CreateImageFromSrc
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2026-04-18 19:38:37 +08:00
Matthew Heon
efba9996f6 Implement --save-stages/--stage-labels for build
These are two new Buildah flags that we need to wire into Podman
(both local and remote) and document, with the interesting note
that one requires the other and a check needed to be added for
that.

Also: secret parsing was tightened up in Buildah, and was
breaking the remote build tests. Rewire it to use the new parser
Buildah made, which ends up simplifying the code considerably.
Tests are back to passing afterwards.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2026-04-17 10:00:32 -04:00
Matthew Heon
5e94c95ad0 Move to deterministic network setup order
This was implemented by containers/netavark #1369; this commit
completes the process by wiring it into Podman. We now respect
the CLI order for configured networks - if a user passes
`--net net1,net2` we guarantee that net1 will be configured
before net2.

For containers created before this patch, we don't retain enough
information to configure networks in CLI order, so we use
alphabetical order instead to still guarantee consistency.

No breaking API changes have been made, but we do add a new
field to supplement the existing map to (optionally) provide
ordering information. The Podman CLI will always pass this.
Existing applications that do not will, again, receive]
deterministic ordering based on an alphabetical sort of network
names.

This requires the latest version of Netavark to work properly.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2026-04-17 10:00:32 -04:00
Nicola Sella
d92cc360f1 Add Pod to quadlet list
Fixes: https://redhat.atlassian.net/browse/RUN-3835

Signed-off-by: Nicola Sella <nsella@redhat.com>
2026-04-17 13:42:16 +02:00
Donal O'Sullivan
f15b8e1b2b Sort cliOpts fields alphabetically in Compat Create
Improve code readability by sorting ContainerCreateOptions field
assignments alphabetically and simplifying access to embedded
Config fields.
Fixes: #28377

Signed-off-by: Donal O'Sullivan <donal.osullivan@elastic.co>
2026-04-16 16:38:26 +01:00
Paul Holzinger
41b785af5e remove isolate option from docker compat API
With netavark v2 we start to default to strict isolation mode in
netavark[1] as such that already matches the docker behavior.

Therefore no longer hard code the isolate option in the compat api.

Podman v6 is requires netavark v2 for other changes already so we do
not need to worry about podman 6 + older netavark here.

[1] https://github.com/containers/netavark/pull/1438

Fixes: #27349

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-04-16 15:56:44 +02:00
Matt Heon
e5f484964a Merge pull request #28495 from Honny1/fix-device-compat-api
Fix Docker API DeviceMapping for CDI devices
2026-04-14 08:42:26 -04:00
Jan Rodák
f374f2c95b Fix Docker API DeviceMapping for CDI devices
Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-04-13 20:56:37 +02:00
Lokesh Mandvekar
9ff3f4cb1e Clean up outdated slirp4netns references in comments
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2026-04-13 09:05:09 -04:00
Paul Holzinger
25aee24cbd use chrootarchive over plain archive package
Just as additional hardening.

Note chrootarchive does not work on macos/windows, in that case it still
falls back to the regular pkg/archive.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-04-08 19:58:07 +02: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
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
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
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
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
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
Š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
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
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
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
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
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
Š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