podman icon indicating copy to clipboard operation
podman copied to clipboard

Add support for `--output` to `podman build --remote`

Open mheon opened this issue 8 months ago • 12 comments

Feature request description

The local Podman client offers the podman build --output option to immediately save a built image to disk as a directory or a tar file. However, this was not implemented for the remote Podman client, which is a significant limitation (all Podman Desktop users are using remote Podman, for example).

Suggest potential solution

I don't see a technical reason why we can't use the existing API for saving images to provide build --output support to the remote client.

Have you considered any alternatives?

Use podman --remote build and podman --remote save

Additional context

Add any other context or screenshots about the feature request here.

mheon avatar Mar 22 '26 14:03 mheon

/assign

kyounghoonJang avatar Mar 23 '26 04:03 kyounghoonJang

@mheon

Hi, I’ve been looking into this and wanted to sanity-check the implementation approach before I start working on it.

My current idea is to follow a flow similar to remote podman save:

  1. Run the build on the server as usual.
  2. Write the --output result to a temporary directroy/file on the server.
  3. Stream/fetch that temporary artifact back to the remote client.
  4. Materialize it at the client-side destination (type=tar, type=local, or stdout).
  5. Clean up the temporary artifact on the server.

Does that sound like the right direction for this issue?

kyounghoonJang avatar Mar 26 '26 04:03 kyounghoonJang

I was going to recommend using the existing Export() API bindings - which will stream directly from storage, instead of requiring you create the artifact on the server side and stream that?

mheon avatar Mar 31 '26 16:03 mheon

I was going to recommend using the existing Export() API bindings - which will stream directly from storage, instead of requiring you create the artifact on the server side and stream that?

Thanks for the reply.

My concern is more about whether Export() is the right abstraction here, since it seems unnecessary to go through saving the image first when the goal is to stream the final rootfs contents directly

Would it make more sense to introduce a separate function, something like ExportRootFS(), for streaming the final rootfs contents directly?

kyounghoonJang avatar Apr 01 '26 09:04 kyounghoonJang

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar May 02 '26 00:05 github-actions[bot]

Hi @mheon and @kyounghoonJang,

Since there hasn't been activity on this issue for a few months, I'd love to take this over and work on adding --output support for podman build --remote.

Thanks!

shivaansh0610-LUFFY avatar Aug 07 '26 04:08 shivaansh0610-LUFFY

/assign

shivaansh0610-LUFFY avatar Aug 07 '26 04:08 shivaansh0610-LUFFY

Hi @mheon, I'm picking this up. I want to confirm the implementation approach before starting:

images.Export() exports a full OCI/Docker image archive (manifests + layers), whereas --output type=local needs just the extracted rootfs. Should the remote client:

Use images.Export() to stream the image archive, then unpack the layers locally to extract the rootfs? Or use a container-level approach (create a temporary container from the built image, export its rootfs, then remove it)?

Thanks!

shivaansh0610-LUFFY avatar Aug 07 '26 04:08 shivaansh0610-LUFFY

I still have some preference for Export() given it's an existing API and guaranteed to work, even if it is less efficient, but I would not object to another approach.

mheon avatar Aug 07 '26 12:08 mheon

Hi @shivaansh0610-LUFFY, I was looking into this issue as well and traced the current remote build path a bit. --output is currently explicitly blocked for remote builds, and BuildOutputs is not passed through the build API. I also checked the existing export paths. containers.Export() already streams a merged container rootfs, so one possible approach seems to be: build remotely, create a temporary container from the resulting image, stream its rootfs back using the existing export API, then handle type=local / type=tar on the client and remove the temporary container. @mheon, since you mentioned preferring the existing Export() APIs, does this direction sound reasonable, or would you still prefer using images.Export() and reconstructing the rootfs client-side? @shivaansh0610-LUFFY, are you still actively working on this? Happy to coordinate if you are.

shrevid03 avatar Aug 17 '26 17:08 shrevid03

Hi! @shrevid03 Yes, I’m still actively working on this. Thanks for looking into the remote build path and for tracing the existing export APIs.

The approach of building remotely, creating a temporary container from the resulting image, and then using containers.Export() to stream the rootfs back sounds reasonable to me. I’ll take a closer look at how type=local / type=tar can be handled client-side with this approach.

I’m also happy to coordinate so we don’t duplicate work. I’ll continue investigating this direction and share any findings/updates here.

shivaansh0610-LUFFY avatar Aug 17 '26 17:08 shivaansh0610-LUFFY

/assign

hihry avatar Aug 29 '26 12:08 hihry