1284 Commits

Author SHA1 Message Date
cfe4d46d89 Optimize image loading for Podman machines
Add support for loading images directly from machine paths to avoid
unnecessary file transfers when the image archive is already accessible
on the running machine through mounted directories.

Changes include:
- New /libpod/local/images/load API endpoint for direct machine loading
- Machine detection and path mapping functionality
- Fallback in tunnel mode to try optimized loading first

This optimization significantly speeds up image loading operations
when working with remote Podman machines by eliminating redundant
file transfers for already-accessible image archives.

Fixes: https://issues.redhat.com/browse/RUN-3249
Fixes: https://github.com/containers/podman/issues/26321

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2025-08-19 12:33:15 +02:00
f38e32760d feat: Add artifact remove --all option
Prior to this commit `artifact remove --all` was not supported on remote
clients.

This patch adds a new artifact API endpoint `artifact/remove` which can
either take a list of artifacts to remove or remove all artifacts by
setting all=true.

This patch removes the temporary warning message in the tunnel interface
implementation of ArtifactRm if `--all` was passed on the command line
and uses the new `artifact/remove` endpoint.

This patch also updates the `artifact remove` command both remote and
local to accept a list of artifacts to remove rather than limiting to
just one.

Signed-off-by: Lewis Roy <lewis@redhat.com>
2025-08-13 23:00:20 +10:00
b7b7839ad3 compat: remove deprecated VirtualSize
Since compat version 1.43 the VirtualSize field in the
GET /images/{name}/json, GET /images/json, and
GET /system/df responses is deprecated and will no
longer be included in API v1.44. Use the Size field
instead, which contains the same information.

Signed-off-by: Nicola Sella <nsella@redhat.com>
2025-08-01 11:46:23 +02:00
23ebb7d94c feat: add Podman artifact support to Go bindings and remote clients
Add the Go bindings implementation necessary to support Artifacts.
Implement the tunnel interface that consumes the Artifacts Go bindings.

With this patch, users of the Podman remote clients will now be able to
manage OCI artifacts via the Podman CLI and Podman machine.

Jira: https://issues.redhat.com/browse/RUN-2714#

Signed-off-by: Lewis Roy <lewis@redhat.com>
2025-08-01 00:10:50 +10:00
610c4c7710 compat: GET /_ping return Builder-Version: 1
Signed-off-by: Nicola Sella <nsella@redhat.com>
2025-07-31 10:17:52 +02:00
1963c6275e compat: remove GET /system/df BuilderSize
Signed-off-by: Nicola Sella <nsella@redhat.com>
2025-07-31 10:17:50 +02:00
b0e7a2ec9b compat: add shared-size par to GET /images/json
Related: https://issues.redhat.com/browse/RUN-2698

Signed-off-by: Nicola Sella <nsella@redhat.com>
2025-07-31 10:17:06 +02:00
b97937ecc4 Merge pull request #26276 from inknos/compat-get-images-json-empty-list-repotags
compat: GET /images/json returns [] instead of <none>:<none> in RepoTags and RepoDigest
2025-07-30 16:09:25 +00:00
eabb64ddaf Merge pull request #26666 from TomSweeneyRedHat/dev/tsweeney/buildah_v1.41.0
Bump Buildah to v1.41.0
2025-07-24 12:24:28 +00:00
ac99084d03 API handler: don't force the SkipUnusedStages flag
Don't force the SkipUnusedStages option one way or another when the
client doesn't specifically request one or the other, so that the server
can choose to use its default behavior.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-07-23 15:55:47 -04:00
55f4d2aa25 API handler: don't force the CompatVolumes flag
Don't force the CompatVolumes option one way or another when the client
doesn't specifically request one or the other, so that the server can
choose to use its default behavior.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-07-23 15:55:16 -04:00
db2baee9fa API handler: don't force the IdentityLabel flag
Don't force the IdentityLabel option one way or another when the client
doesn't specifically request one or the other, so that the server can
choose to use its default behavior.

Fixes #26669

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-07-23 15:54:47 -04:00
7517e3267a remote build: relay more new flags introduced in buildah 1.41
Wire up the source-date-epoch, rewrite-timestamp, and created-annotation
flags so that a client can correctly ask a server to honor them.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-07-23 15:52:43 -04:00
73f3e98947 Feat: send additional build contexts for remote builds
Fixed the --build-context flag to properly send files for remote builds. Previously
only the main context was sent over as a tar while additional contexts were passed as
local paths and this would cause builds to fail since the files wouldn't exist.

New changes modifies the Build API to use multipart HTTP requests allowing multiple
build contexts to be used. Each additional context is packaged and
transferred based on its type:
- Local Directories: Sent as tar archives
- Git Repositories: link sent to the server where its then cloned
- Container Images: Image reference sent to the server, it then pulls the image there
- URLs/archives: URL sent to the server, which handles the download

Fixes: #23433

Signed-off-by: Joshua Arrevillaga <2004jarrevillaga@gmail.com>
2025-07-23 11:34:38 -04:00
2f71314b4a Add CLI updates for inherit and unset annotations
Add CLI updates for --inheritannotations and --unsetannotations

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2025-07-23 10:36:22 -04:00
87d88c3b09 Merge pull request #26432 from stefwalter/dont-html-escape-json
api: Don't HTML escape application/json responses
2025-06-30 14:47:55 +00:00
fed198eaf9 api: Don't HTML escape application/json responses
An HTTP response with Content-Type application/json does not need
to be HTML escaped. Doing this causes encoding issues in the Podman
REST API output as seen in the issue:

Fixes #17769

Remove the HTML escaping from Content-Type: application/json responses.

Signed-off-by: Stef Walter <stef@thewalter.net>
Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-30 12:54:19 +02:00
5786d5f846 fix new lint errors from the docker update
Some new deprecated fields, we still have to set them since clients
might still use them.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-06-27 16:35:40 +02:00
9d328d8782 pkg/api: remove deadcode
One might think Close() should be called but we are already using
Shutdown() which is the graceful way to stop the server so we don't
actually need Close().

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-06-26 19:37:13 +02:00
75bad52af5 remove unused ShouldRestart() code
Deadcode should that the ShouldRestart() API endpoint was never wired
into the router so the endpoint did not existed and the bindings called
a non existing endpoint which returnd 404 which the binding code
assumed means no restart.

As such remove all this code as it didn't do anything useful. And IMO
exposing a shouldrestart API always feeled wrong to me. The client
should not have to deal with this.

This commit does not change the behavior but it also does not make an
attempt to fix the broken restart handling with the rmeote client. Given
we do not seem to have any user reports about this it seems it is not
used.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-06-26 19:37:13 +02:00
494287518b Merge pull request #26467 from ygalblum/secret-create-ignore
Secret create - add ignore option to allow noop
2025-06-26 15:25:52 +00:00
683e9b2c94 Merge pull request #26434 from mheon/import_export
Add remote support for `podman volume import` and `podman volume export`
2025-06-25 19:48:14 +00:00
bfc327a08e Secret create - add ignore option to allow noop
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2025-06-24 15:43:38 -04:00
98876454cb Refactor volume import to support the remote client
As with `volume export`, this was coded up exclusively in cmd/
instead of in libpod. Move it into Libpod, add a REST endpoint,
add bindings, and now everything talks using the ContainerEngine
wiring.

Also similar to `volume export` this also makes things work much
better with volumes that require mounting - we can now guarantee
they're actually mounted, instead of just hoping.

Includes some refactoring of `volume export` as well, to simplify
its implementation and ensure both Import and Export work with
readers/writers, as opposed to just files.

Fixes #26409

Signed-off-by: Matt Heon <mheon@redhat.com>
2025-06-23 13:42:22 -04:00
1f9893817b volumes: add new --uid and --gid option
they allow to override the owner of the volume.  Differently from
-o=uid= and -o=gid= they are not passed down to the mount operation.

Closes: https://issues.redhat.com/browse/RHEL-76452

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2025-06-18 15:33:09 +02:00
3ef33653ff compat: RepoTags and RepoDigest return [] and not null
Signed-off-by: Nicola Sella <nsella@redhat.com>
2025-06-17 15:43:05 +02:00
63bf454d66 Refactor podman export to work with the remote client
Previously, our approach was to inspect the volume, grab its
mountpoint, and tar that up, all in the CLI code. There's no
reason why that has to be in the CLI - if we move it into
Libpod, and add a REST endpoint to stream the tar, we can
enable it for the remote client as well.

As a bonus, previously, we could not properly handle volumes that
needed to be mounted. Now, we can mount the volume if necessary,
and as such export works with more types of volumes, including
volume drivers.

Signed-off-by: Matt Heon <mheon@redhat.com>
2025-06-14 07:42:38 -04:00
d44f0afa84 vendor: update github.com/docker/docker to v28.2.2
Two incomptable changes, they removed the BridgeNfIP6tables
and BridgeNfIptables fields so we must drop them. As they are not
important ones that should not cause problems.

Second, they moved to using DockerOCIImageConfig from another new module.
The json format did not chnage so this is not an external API break.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-06-05 12:19:58 +02:00
99cfdc04db feat: Add OCI Artifact support to the Podman REST API
This patch adds a new endpoint to the REST API called "artifacts" with
the following methods:
- Add
- Extract
- Inspect
- List
- Pull
- Push
- Remove

This API will be utilised by the Podman bindings to add OCI Artifact
support to our remote clients.

Jira: https://issues.redhat.com/browse/RUN-2711

Signed-off-by: Lewis Roy <lewis@redhat.com>
2025-06-04 15:49:34 +10:00
3a981915f0 Handle "Entrypoint":[] in compat containers/create API.
When using `docker compose run --entrypoint ''`, docker sends
`"Entrypoint": []` in the JSON. Podman currently treats that
as `nil` and fallback to default image entrypoint.

This is not what is expected by the user. Instead, it should
not use any entrypoint.

This commit fixes it by properly propagating the `[]` downstream
to libpod.

Fixes: #26078

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2025-05-29 08:45:35 +02:00
66bf98e27c compat API: respect base_hosts_file containers.conf option
Hard coding to none without checking containers.conf is not a good idea
as users who liked the previous behavior and the podman default behavior
of keeping the hosts entries can no longer do that.

With this commit they can set base_hosts_file = "/etc/hosts" to restore
the previous behavior.

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

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-05-26 16:16:10 +02:00
5629ba8a8d Merge pull request #26149 from azdle/docker-api-container-status
compat: fix ContainerState.Status JSON values
2025-05-20 17:53:12 +00:00
92a15085cb compat: fix Container State.Status JSON values
This mirrors the conversion currently being done in `LibpodToContainer`
into `LibpodToContainerJSON`, converting podman style statuses to docker
style statuses as defined in their OpenAPI definition:

https://docs.docker.com/reference/api/engine/version/v1.49/#tag/Container/operation/ContainerInspect

Fixes: #17728

Signed-off-by: Patrick Barrett <patrick@psbarrett.com>
2025-05-20 10:22:45 -05:00
e32b57b1ea Merge pull request #26115 from inknos/compat-get-info-defaultaddresspool
compat: Add DefaultAddressPools field to GET /info
2025-05-20 14:37:22 +00:00
7c0262db3d compat: Add DefaultAddressPools field to GET /info
Signed-off-by: Nicola Sella <nsella@redhat.com>
2025-05-16 13:16:27 +02:00
b82f2962c3 compat: Add CgroupnsMode to POST /containers/create
Signed-off-by: Nicola Sella <nsella@redhat.com>
2025-05-15 15:31:16 +02:00
857cfb9062 Merge pull request #25861 from cesargoncalves/main
update podman socket output to include also exposed ports
2025-05-06 19:10:36 +00:00
ce0bac24e5 Merge pull request #25986 from Honny1/fix-unlimited-ulimits
Fix handling of "r_limits" in Podman REST API /libpod/containers/create
2025-04-28 22:27:40 +00:00
2679304aa8 Merge pull request #25983 from matejvasek/fix-inherit-label
Fix: inheritlabels=true if query param absent
2025-04-28 16:02:48 +00:00
e66ff395b7 Fix handling of "r_limits" in Podman REST API /libpod/containers/create
The JSON decoder correctly cannot decode (overflow) negative values (e.g., `-1`) for fields of type `uint64`, as `-1` is used to represent `max` in `POSIXRlimit`. To handle this, we use `tmpSpecGenerator` to decode the request body. The `tmpSpecGenerator` replaces the `POSIXRlimit` type with a `tmpRlimit` type that uses the `json.Number` type for decoding values. The `tmpRlimit` is then converted into the `POSIXRlimit` type and assigned to the `SpecGenerator`.

This approach ensures compatibility with the Podman CLI and remote API, which already handle `-1` by casting it to `uint64` (`uint64(-1)` equals `MaxUint64`) to signify `max`.

Fixes: https://issues.redhat.com/browse/RUN-2859
Fixes: https://github.com/containers/podman/issues/24886

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2025-04-28 15:02:19 +02:00
6e7de438cc bug: Correct Docker compat REST API image delete endpoint
The Docker `-XDELETE image/$name?force=true` endpoint only removes
containers using an image if they are in a non running state.

In Podman, when forcefully removing images we also forcefully delete
containers using the image including running containers.

This patch changes the Docker image force delete compat API to act like the
Docker API while maintaining commands like `podman rmi -f $imagename`

It also corrects the API return code returned when an image is requested
to be deleted with running containers using it.

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

Signed-off-by: Lewis Roy <lewis@redhat.com>
2025-04-27 20:51:11 +10:00
a969dbd73e update podman socket output to include also exposed ports
Fixes https://github.com/containers/podman/issues/25851

Co-authored-by: Brent Baude <bbaude@redhat.com>
Signed-off-by: Cesar Goncalves <mail@cesargoncalves.com>
2025-04-27 11:11:28 +01:00
0c4d023822 Fix: inheritlabels=true if query param absent
The inheritlabels param must default to true if query param is absent.

Signed-off-by: Matej Vašek <matejvasek@gmail.com>
2025-04-25 19:17:00 +02:00
10d768baaf Add inherit-labels option to Build API
Add the inherit-labels option to the build API and tweak the go.mod
after some unhappiness in my sandbox.

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2025-04-22 23:06:57 -04:00
3cbb718049 Fix compat API in rootless mode ignores ulimits
Fixes: https://github.com/containers/podman/issues/25881

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2025-04-17 16:11:34 +02:00
f26765ceb0 update golangci-lint to v2.1.1
Fixes three new issues found by nilnesserr.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-04-14 19:33:42 +02:00
0f975f8526 ci: rm allow-unused from nolintlint settings
This was added by commit 84e42877a ("make lint: re-enable revive"),
making nolintlint became almost useless.

Remove the ungodly amount of unused nolint annotations.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
f4f2580b0d ci: remove stylecheck linter
It is to be merged into staticcheck linter in golangci-lint v2.0.0.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
0dddc5e3c0 Apply De Morgan's law
This fixes a bunch of "QF1001: could apply De Morgan's law" warnings
from staticcheck linter.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
44cbefff5d fix remove unnecessary err check
Signed-off-by: sianao <me@sianao.site>
2025-03-27 15:27:52 +08:00