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>
This commit is contained in:
Jan Rodák
2025-08-07 14:58:08 +02:00
parent 0a9d5ca75d
commit cfe4d46d89
11 changed files with 333 additions and 44 deletions

View File

@ -941,6 +941,30 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// 500:
// $ref: '#/responses/internalError'
r.Handle(VersionedPath("/libpod/images/load"), s.APIHandler(libpod.ImagesLoad)).Methods(http.MethodPost)
// swagger:operation POST /libpod/local/images/load libpod LocalImagesLibpod
// ---
// tags:
// - images
// summary: Load image from local path
// description: Load an image (oci-archive or docker-archive) from a file path accessible on the server.
// parameters:
// - in: query
// name: path
// type: string
// required: true
// description: Path to the image archive file on the server filesystem
// produces:
// - application/json
// responses:
// 200:
// $ref: "#/responses/imagesLoadResponseLibpod"
// 400:
// $ref: "#/responses/badParamError"
// 404:
// $ref: "#/responses/imageNotFound"
// 500:
// $ref: '#/responses/internalError'
r.Handle(VersionedPath("/libpod/local/images/load"), s.APIHandler(libpod.ImagesLocalLoad)).Methods(http.MethodPost)
// swagger:operation POST /libpod/images/import libpod ImageImportLibpod
// ---
// tags: