Add support for `--output` to `podman build --remote`
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.
/assign
@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:
- Run the build on the server as usual.
- Write the
--outputresult to a temporary directroy/file on the server. - Stream/fetch that temporary artifact back to the remote client.
- Materialize it at the client-side destination (
type=tar,type=local, or stdout). - Clean up the temporary artifact on the server.
Does that sound like the right direction for this issue?
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?
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?
A friendly reminder that this issue had no activity for 30 days.
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!
/assign
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!
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.
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.
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.
/assign