Commit Graph
1722 Commits
Author SHA1 Message Date
Danish Prakash 1246f0ab8e Merge pull request #27481 from Retr0-XD/label
feat(kube play): flag to specify resources (pods, secrets, volumes) labels #26450
2026-10-08 11:20:10 +05:30
Jan Rodák fd25df818b compat stats: fix system_cpu_usage, precpu_stats, one-shot CPU%, and docs
- Read system_cpu_usage from /proc/stat (first 7 CPU fields, including idle) instead of cgroups.SystemCPUUsage(), matching Docker semantics.
- Use CPU values from GetContainerStats() instead of a second cgroup read to avoid a timing gap.
- Populate precpu_stats on stream=false with a 100 ms sampling pauseso the Docker CPU% formula returns a directionally correc snapshot. This only affects the compat per-container endpoint; podman-remote stats uses a separate libpod handler.
- Return cpu_stats.cpu as 0 for one-shot=true since the two samples are only milliseconds apart.
- Replace direct precpu copy instead of JSON marshal/unmarshal round-trip.
- Propagate errors via fmt.Errorf instead of logrus.Errorf, letting callers decide how to handle them. Parse errors in /proc/stat fields are hard errors instead of silently returning partial data.
- Document that --no-stream CPU% is a coarse ~100 ms snapshot; streaming gives 5-second interval readings.

Fixes: https://github.com/podman-container-tools/podman/issues/28761
Fixes: https://github.com/podman-container-tools/podman/issues/24730
Fixes: https://github.com/podman-container-tools/podman/issues/29912
Fixes: https://github.com/podman-container-tools/podman/issues/25709

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-10-07 13:19:53 +02:00
Sakthi Harish faf93bb0ca feat(kube play): add --label flag to specify resource labels
Adds a -l/--label CLI flag to podman kube play and wires it through
the API, bindings, and ABI so user-provided labels are applied to pods,
PVCs, and secrets created from Kubernetes YAML.

Key features:
- Labels are merged with YAML labels (CLI takes precedence)
- Validation uses Kubernetes qualified-name rules (RFC1123 subdomains)
- Value validation enforces 63-char limit and charset rules
- Separate merge and validate functions (SOLID principle)
- Uses maps.Clone for cleaner merging

Fixes:
- Removed incorrect annotations size limit from label validation
- Refactored to call annotations.IsQualifiedName for key validation
- Added proper documentation for max key length enforcement

Closes #26450

Signed-off-by: Sakthi Harish <sakthi.harish@edgeverve.com>
2026-10-06 13:45:32 +00:00
Nalin Dahyabhai eda29a56bf image build contexts: pay attention to tlsVerify flags
When fetching build context tarballs for use in a build, pay attention
to the tlsVerify setting at the command line (in non-remote cases) or in
the build query (in remote cases), and whatever proxy settings are set
in the current environment for whichever process is connecting to a
server that may or may not be using TLS.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2026-09-29 06:05:20 -04:00
Nalin Dahyabhai 61195895f3 Pass context.Context values down to newer buildah APIs
Buildah added some variants of APIs that should improve support for
cancellation, so let's use them.

Remove the import alias for its copier package in
cmd/podman/containers/cp.go and libpod/container_copy_common.go to be
more friendly to grep.

Update the "prune leftover build containers" test to intentionally leave
some behind during its setup instead of SIGKILLing a build process.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2026-09-29 06:05:20 -04:00
Rudraksha Singh 2ac2529bf7 compat: ignore dead and restarting status filters
Docker documents `dead` and `restarting` as valid values for the
`status` filter on `/containers/json`. Podman returns HTTP 500 when
either of them is used even though no Podman container can ever be in
those states.

Ignore these values in the compat API. If they are the only status
filters, return an empty list like Docker does. Invalid status values
still return an error.

The libpod API still rejects these values since they are Docker
specific. Update the libpod API docs to list the states Podman
actually supports.

Reference:
https://docs.docker.com/reference/api/engine/version/v1.51/#tag/Container/operation/ContainerList

Fixes: #28904
Signed-off-by: Rudraksha Singh <rudraksharss@gmail.com>
2026-09-29 00:21:19 +05:30
Matt Heon 5866b09c1f Merge pull request #29726 from r-vdp/compat-inline-seccomp
compat API: accept inline seccomp profiles
2026-09-24 09:01:54 -04:00
r-vdp 4ce2583ad7 compat API: accept inline seccomp profiles
Docker clients send the seccomp profile JSON itself in
HostConfig.SecurityOpt (the docker CLI reads the profile file
client-side and inlines it). The compat API treated the value as a path
to a profile file, so container create failed with "file name too
long". This breaks docker-compat tooling that passes seccomp profiles
through the socket, like Nextcloud AIO and forgejo-runner.

Add a SeccompProfile field to specgen for inline profile content,
next to the existing SeccompProfilePath, as requested in review of the
earlier PR that tried to fix this (#28985). The compat create handler
extracts inline profiles (values starting with "{") from SecurityOpt
and sets the new field. Path-based values and "unconfined" keep their
current meaning, and duplicate seccomp options resolve last-one-wins,
like docker.

Fixes: #27710

Signed-off-by: r-vdp <ramses@well-founded.dev>
2026-09-24 10:31:00 +02:00
Matt Heon 0fff70d9a0 Merge pull request #29827 from Honny1/fix-pids-max
Map pids-limit 0 to unlimited for runc
2026-09-23 17:38:09 -04:00
Jan Rodák 5fa0cb1090 Map pids-limit 0 to unlimited for runc
Docker documents HostConfig.PidsLimit 0 as unlimited, but runc sets
pids.max=1 for OCI pids.limit 0. Normalize 0 to -1 when building the
OCI spec so native CLI, compat API, and kube play behave consistently.

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

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-09-23 20:45:45 +02:00
Jan Rodák 253e24f65e Merge pull request #28358 from aaron-ang/issue-17726-distribution-api
api: implement compat distribution inspect endpoint
2026-09-23 10:49:31 +02:00
Aaron Ang 3611b67505 api: implement compat distribution inspect endpoint
Fixes: #17726
Signed-off-by: Aaron Ang <aaron.angyd@gmail.com>
2026-09-22 21:14:45 -04:00
Marek Simek 9a32b4a31c compat: Omit empty Created field from GET /images/{id}/json
Docker API v1.44 omits the Created field (previously,
it was the zero value of 0001-01-01T00:00:00Z) if
the Created field is missing from the image config.

Omit it when zero from the compat API GET /images/{id}/json
(using `info.Created` instead of the previous `l.Created()`
that is set to `Now()` in storage/images.go when empty).

Add a test creating an image with the Created field missing.

Fixes: https://redhat.atlassian.net/browse/RUN-3317
Signed-off-by: Marek Simek <msimek@redhat.com>
2026-09-22 10:03:51 +02:00
Matt Heon 109bd7acd2 Merge pull request #29791 from evanpurkhiser/codex/auto-update-filter
auto-update: Add container filters
2026-09-21 15:01:10 -04:00
Danish Prakash 196e082727 Merge pull request #28686 from mheon/exec_no_streams_auto_detach
Allow running exec with no attach streams requested
2026-09-22 00:02:59 +05:30
Matthew Heon 7487854f10 Allow running exec with no attach streams requested
This is a small Docker compat fix with the API exec endpoints.
With Docker, sending a bare Exec Create (command only, nothing
else set) and then an Exec Start without Detach set performs
a detached exec. With Podman, we threw an error that at least one
stream must be attached to. Fix is trivial; look up the session
before start, check the config for attach streams, and force
detach on if none are set.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2026-09-21 10:34:55 -04:00
Oleksandr Krutko ff2eb1b0ca The feature which allows multiple Pods creation
Fixes: #26769

Signed-off-by: Oleksandr Krutko <alexander.krutko@gmail.com>
2026-09-20 15:41:06 +03:00
Matt Heon 0d12a23e7b Merge pull request #29795 from arcusbuilds/compat-update-keep-restart-policy
compat: Restart policy no longer resets on compat update
2026-09-19 15:27:58 -04:00
Ashley Cui dde83193d1 Merge pull request #28633 from aayushbaluni/fix/28378-iprange-compat-api
fix: include IPRange in Docker-compat network IPAM config
2026-09-18 16:36:36 -04:00
Jan Rodák 77d1fdf87a Merge pull request #29303 from virzak/fix/compat-info-rootless-cgroup-driver
compat: report cgroup driver "none" when rootless with cgroupfs
2026-09-18 11:42:45 +02:00
Srijan Keshri a50f49cab0 compat: Restart policy no longer resets on compat update
Fixed the compat container update path so it preserves the existing restart policy unless the request explicitly includes a new one, and added a regression test for it.

Fixes: #29790
Signed-off-by: Srijan Keshri <212402043+arcusbuilds@users.noreply.github.com>
2026-09-18 04:06:24 +00:00
Evan Purkhiser 9309b9183c auto-update: Add container filters
Allow deployments and scheduled jobs to update a selected group of
containers without checking every auto-update-enabled application.
Reuse the existing container filters and expose them through the CLI,
remote bindings, and REST API.

Filter update candidates while preserving systemd unit and pod restart
behavior. Document the selection semantics and cover filtered updates,
invalid input, remote requests, and pod restarts in the existing tests.

Signed-off-by: Evan Purkhiser <git@evanpurkhiser.com>
2026-09-17 11:16:58 -04:00
Jan Rodák fda861989d Merge pull request #29395 from scallaway/image-scp-compression
image scp: add --compression-format and --compression-level
2026-09-17 17:09:06 +02:00
Stefan Nienhuis 9c923c019e feat: Implement auto update support for podman-remote
Signed-off-by: Stefan Nienhuis <stefan@nienhuisdevelopment.com>
2026-09-17 11:08:24 +02:00
Matt Heon c1922ea665 Merge pull request #29762 from madhoshyagnik/fix-quadlets-multipart
pkg/api/handlers/libpod: close quadlets multipart files per iteration and prevent duplicates
2026-09-16 10:05:15 -04:00
aayushbaluni 9f6b99950b fix: include IPRange in Docker-compat network IPAM config
The Docker-compatible network API omitted the IPRange field from the IPAM
config even though Libpod stores this data, so tools reading the Docker
API could not see the configured IP range.

Map Libpod's LeaseRange to Docker-compatible IPAMConfig.IPRange when it
aligns with a full CIDR span derived from FirstIPInSubnet/LastIPInSubnet,
and add an integration test that creates a network via the compat API with
an explicit IPRange and asserts it is returned on inspect.

The span is matched with bit arithmetic rather than by trying every prefix
length: the network address is start-1, and XORing that with end yields the
host mask, which identifies the prefix in a single pass. net/netip carries
the address handling throughout - Unmap collapses 4-in-6, Prev gives the
network address, and Masked confirms the network is aligned to the prefix.

Fixes: #28378

Signed-off-by: aayushbaluni <73417844+aayushbaluni@users.noreply.github.com>
2026-09-16 10:01:35 +05:30
Jan Rodák 525dfd8700 Merge pull request #29758 from haneul-24/fix/api-endpoint-content-type
fix: set correct content-type for generate kube
2026-09-15 11:09:46 +02:00
Madhosh Yagnik 94b0c1df14 pkg/api/handlers/libpod: close quadlet files per iteration and prevent duplicates
processMultipartQuadlets previously deferred closing each multipart part
and file inside the loop, leaking descriptors until the handler returned.
It also opened files with os.Create, silently overwriting earlier files if
a request contained parts with duplicate names.

Align processMultipartQuadlets with the manifests multipart upload handler:
- Wrap each part processing in a closure so part and file descriptors close
  immediately on each loop iteration.
- Use os.OpenFile with os.O_CREATE|os.O_EXCL|os.O_WRONLY (0600) so duplicate
  filenames return an error instead of silently overwriting.
- Sanitize filenames using filepath.Base to prevent directory traversal.
- Add unit tests verifying multiple file extraction, duplicate name rejection,
  and path traversal sanitization.

Fixes: #29752
Signed-off-by: Madhosh Yagnik <madhosh1yagnik@gmail.com>
2026-09-14 23:55:57 +05:30
Paul Holzinger 687c5e644a Merge pull request #29525 from sahilnyk/exec-sigproxy-pgid
exec: forward signals to the exec session's process group
2026-09-14 13:32:46 +02:00
Sahil Nayak 903a1b6cb6 exec: forward signals to exec sessions over local and remote
Fixes: #19486
Signed-off-by: Sahil Nayak <contactsahilpnayak@gmail.com>
2026-09-11 21:32:26 +05:30
Matt Heon b638cc9f48 Merge pull request #29295 from InvalidInterrupt/fix_api_restart_def_timeout
Respect container StopTimeout in container restart REST APIs
2026-09-11 06:40:44 -04:00
Scott Callaway 79b35ad0d9 image scp: accept --compression-format=none
Until now the default could only be expressed by leaving the option off, which
reads as an omission rather than a choice and gives a script no way to say it
wants the archive transferred as podman save wrote it.

Accept none as a format meaning exactly that. It is taken on the API path too,
so both interfaces share one vocabulary, and it is treated as the absence of a
format throughout: nothing is compressed, a level attached to it is rejected the
same way a level with no format is, and the local user to user transfer has
nothing to warn about ignoring.

The remote client still leaves it off the request, so naming the default does
not make a transfer fail against a service that predates these options.

Signed-off-by: Scott Callaway <github@scottcallaway.co.uk>
2026-09-10 16:45:30 +01:00
Scott Callaway 8d5b091a45 image scp: pass the compression options over the remote API
The tunnel engine builds its own ScpOptions, so without this the flags parse
fine under podman --remote and are then dropped, transferring uncompressed with
no indication that anything was ignored.

Carry both options through the bindings to the libpod ImageScp handler, which
hands them to ExecuteTransfer the same way the local path does, and document
them on the endpoint.

This is also the point at which the transfer's own validation becomes reachable
over HTTP, so map it accordingly: a rejected format or level is the caller's
mistake and answers 400, not the 500 every error from the transfer used to
produce.

Signed-off-by: Scott Callaway <github@scottcallaway.co.uk>
2026-09-07 16:03:54 +01:00
Sejal b5b558d671 fix: set correct content-type for generate kube
Fixes: #29674
Signed-off-by: Sejal <sej1306kook@gmail.com>
2026-09-05 23:21:50 +00:00
Paul Holzinger 3222b4bc25 fix new golangci-lint staticcheck warnings
Looks like it picked up new deprecated matches so we need some more
nolint to silence them where we still need them for backwards compat in
the API.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-09-04 16:40:03 +02:00
Paul Holzinger 53a9bcbe13 run golangci-lint --fix
In order to fix the new formatting issues reported.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-09-04 16:30:10 +02:00
Paul Holzinger afe45cccb6 Merge pull request #29714 from Luap99/go-1.26
Update to Go 1.26
2026-09-04 15:48:09 +02:00
Victor Irzak a7f33feaf7 compat: report cgroup driver "none" when rootless with cgroupfs
Rootless Podman with the cgroupfs manager cannot create a cgroup parent outside its delegated subtree, and container creation already leaves the parent unset there. Reporting "cgroupfs" makes buildx pin its BuildKit container to /docker/buildx, which crun then fails to create with EPERM.

Report "none", as rootless Docker does.

Fixes: #27824

Signed-off-by: Victor Irzak <victor.irzak@zomp.com>
2026-09-04 09:23:48 -04:00
Paul Holzinger 8b216d16c4 Merge pull request #29656 from hkwi/fix-compat-stats-http-status
api: reflect container stats errors in HTTP status codes
2026-09-04 15:17:42 +02:00
Paul Holzinger 258001db67 Merge pull request #29496 from simek-m/RUN-3319-info-runtimes-status
compat: Add status for runtimes to GET /info
2026-09-04 13:54:34 +02:00
Hiroaki KAWAI d56f52c8a7 api: reflect container stats errors in HTTP status codes
Existing KillContainer handling uses HTTP status code 409 when the request cannot be performed because of the current container state. HTTP status code 404 is also used when the target container does not exist.

In contrast, errors from the stats handler are not reflected in the HTTP status code. The HTTP status code is always 200, and the errors are recorded only as generic errors in the server log.

To maintain compatibility with both streaming enabled and disabled, this change treats obtaining at least one complete unit of response content as the response contract. It then keeps the response content consistent with the HTTP status code.

Signed-off-by: Hiroaki KAWAI <hiroaki.kawai@gmail.com>
2026-09-04 20:42:55 +09:00
Paul Holzinger 6c6eac3a5c run modernize -fix ./...
Since I use go 1.26 the go fix does not have all the rules built in,
there are newer ones in modernize so run the explicitly to fix more code
for go 1.26.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-09-04 11:53:04 +02:00
Jan Rodák ec30171911 Merge pull request #29660 from simek-m/RUN-3316-compat-until-filter
compat: Document and test GET /images/json until filter
2026-09-04 11:45:24 +02:00
Marek Simek 81ec75c4ec compat: Add status for runtimes to GET /info
Docker API v1.44 now includes status properties
in Runtimes for the GET /info endpoint.

Read output of {oci_runtime_cmd} features command
lazily and expose the JSON
output as-is (with removed new lines and
whitespace) as the status field in GET
/info for v1.44+.

Add status to libpod GET /info in ociRuntime.features
and `podman info` (shared).

Add API tests for both endpoints.

Fixes: https://redhat.atlassian.net/browse/RUN-3319
Signed-off-by: Marek Simek <msimek@redhat.com>
2026-09-04 11:37:47 +02:00
Paul Holzinger f6487b7546 Merge pull request #29669 from CodeWithAK28/manifest-annotate-subject-remote
pkg/bindings, pkg/api: send the manifest index subject to the server
2026-09-03 18:21:01 +02:00
Garry Lawrence 545674291a Respect container StopTimeout in container restart REST APIs
RestartContainer was always setting options.Timeout with values
from query, without checking if the caller had specified them or if
they were simply zero values. Copy logic from StopContainer to check
for caller-specified values, leaving Timeout nil if not specified.

fixes: https://github.com/podman-container-tools/podman/issues/29276
Signed-off-by: Garry Lawrence <InvalidInterrupt@users.noreply.github.com>
2026-09-02 10:39:55 -07:00
Anisha Khairnar b760306614 pkg/bindings, pkg/api: send the manifest index subject to the server
Two commands can set a subject on a manifest list, podman manifest annotate --index --subject and podman manifest add --artifact-subject. Both work locally, but they do nothing at all when podman runs with --remote.

The value never leaves the client. Before sending the request the remote client copies everything into manifests.ModifyOptions and manifests.AddArtifactOptions, and neither struct had a field to hold the subject, so it was quietly thrown away. The server had a second problem of its own, ManifestModify rebuilds ManifestAddArtifactOptions by hand and left out the embedded ManifestAnnotateOptions, so --os, --arch and --annotation were being dropped there as well.

Add the missing field to both structs, fill it in from the tunnel ImageEngine, and let the handler pass the annotate options along. Also add two system tests that run both flags for real so the remote path stays covered.

Signed-off-by: Anisha Khairnar <anishakhairnar284@gmail.com>
2026-09-02 11:57:43 +05:30
Ashley Cui af579ec299 Add --platform to podman push
When pushing a manifest list, --platform=OS[/Arch[/Variant]] selects and pushes a single platform-specific manifest instead of the entire list.
Also, update compat POST /images/{name}/push to support the platform param (Compat v1.46)

Signed-off-by: Ashley Cui <acui@redhat.com>
2026-09-01 11:30:48 -04:00
Marek Simek d6c2cf29dd compat: Document and test GET /images/json until filter
The `until` filter was missing from the documentation.
Document it for both GET /libpod/images/json and the
compat GET /images/json.

Add tests for the until filter exercising both endpoints.

Fixes: https://redhat.atlassian.net/browse/RUN-3316
Signed-off-by: Marek Simek <msimek@redhat.com>
2026-08-31 12:11:36 +02:00
Miloslav Trmač ca42cbff0a Merge pull request #29628 from mehrdadbn9/fix/29627-stats-nil-pointer
fix(api): nil check Memory.Limit before dereference in stats handler
2026-08-24 15:43:09 +02:00