Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFE: Save multiple manifests to a single file #610

Closed
haircommander opened this issue Apr 1, 2019 · 22 comments · Fixed by #996
Closed

RFE: Save multiple manifests to a single file #610

haircommander opened this issue Apr 1, 2019 · 22 comments · Fixed by #996
Assignees
Labels
kind/feature A request for, or a PR adding, new functionality

Comments

@haircommander
Copy link

There have been some requests for podman to match docker functionality in a podman save:
containers/podman#2822
containers/podman#2669

A blocker on this is the fact we can't save multiple images to the same file with containers/image. There could be a hacky work around saving them to a temp file, then appending all the files at the end, but I'd rather this happen natively in c/image.

@haircommander
Copy link
Author

@mtrmac PTAL

@mtrmac
Copy link
Collaborator

mtrmac commented Apr 1, 2019

Yeah, as mentioned before, c/image does not have a concept of “a pending set of images”.

I’m not convinced it’s reasonable to make this a generic c/image concept, notably because the way how to designate images in that set, and the semantics of naming within the set, would be pretty tricky.

But specifically for docker-archive: (or, for any other single transport), it should be reasonably possible to implement a docker/archive.ArchiveWriter (with a better name), used something like:

wip := archive.NewArchiveWriter(destPath)
for /* sourceRef, destinationTag */ {
   destRef := wip.NewReference(destinationTag)
   copy.Image(…, sourceRef, destinationRef, …)
}
wip.Finish()

+ adapting the existing archive.archiveReference to internally create a single-image ArchiveWriter that is transparently Finished on Commit.

@haircommander
Copy link
Author

@mtrmac Without even doing that, we could also have a Archive writer append to a file, no? That way, podman can just make consecutive image.Save() on the same destination and they will all end up in the same file.

@haircommander
Copy link
Author

(note: this is me speaking with near zero understanding of how c/image works, so please excuse my inexperience :) )

@mtrmac
Copy link
Collaborator

mtrmac commented Apr 1, 2019

@mtrmac Without even doing that, we could also have a Archive writer append to a file, no?

Not really, the archive must contain a single manifest.json file that describes all images.

Sure, each update could also append an updated version of that manifest.json — but I don’t know whether it is formally specified anywhere what a tar file with duplicates means, but it’s certainly unwise to rely these corner cases — and anyway, c/image itself, when reading from docker-archive: files, currently uses the first instance matching the requested file path.

@haircommander
Copy link
Author

@mtrmac ah yeah okay. Are you able to implement the above solution on c/image side? I can handle adding it to podman, if so. We had another user ask on IRC today, which sets the request count to three. We can start with just the docker-archive: case right now, I think.

@rhatdan
Copy link
Member

rhatdan commented Apr 13, 2019

@haircommander @mtrmac What is the latest on this?

@rhatdan
Copy link
Member

rhatdan commented May 29, 2019

@mtrmac we need input on this.

@mtrmac
Copy link
Collaborator

mtrmac commented May 29, 2019

*shrug* the technical design is clear enough, but I don’t really want to commit to a feature and a timeline to deliver it in a GitHub comment independently from the kanban board.

@haircommander
Copy link
Author

@mtrmac I'll add the card and we can discuss timeline there :)

@ruckc
Copy link

ruckc commented Jun 14, 2019

this bit me today, and i've been trying to champion podman over docker, because of my faith in @rhatdan.

@rhatdan
Copy link
Member

rhatdan commented Aug 5, 2019

@haircommander any update on this?

@vrothberg
Copy link
Member

Ping

@haircommander
Copy link
Author

as reported here containers/podman#2669 (comment)
I don't currently have the bandwidth to take this on ☹️

@marcfiu
Copy link

marcfiu commented Mar 30, 2020

I am trying to champion podman over docker; however, colleagues use "docker save" to air gap images to a docker-archive tarball. This translates into "podman" not being a drop-in replacement "docker", which is suboptimal. At the least, "podman save" should error out indicating "can't do multiple images" rather than silently succeeding with something that is simply not equivalent to "docker save".

@rhatdan
Copy link
Member

rhatdan commented Mar 30, 2020

@baude @vrothberg This needs to be a top priority once APIV2 is complete.

@vrothberg
Copy link
Member

I believe there's already a card for it. After v2, I need to get back to systemd and auto updates first.

@marcfiu
Copy link

marcfiu commented Mar 30, 2020

@baude @vrothberg This needs to be a top priority once APIV2 is complete.

@rhatdan: what's the timeline for APIV2?

@rhatdan
Copy link
Member

rhatdan commented Mar 30, 2020

Within the next month. If someone wanted to contribute a PR to this effort, that would certainly speed up the process.

@marcfiu
Copy link

marcfiu commented Mar 30, 2020

@rhatdan: wish we were in a position to make such a PR contribution. Short of that maybe next time I'm in your neck of the woods (which I believe is 2-3 miles down the road from some of my colleagues' office in W***ford), I'll be happy to buy you a beer at the BBC.

@rhatdan
Copy link
Member

rhatdan commented Mar 31, 2020

Sure if we ever get out of lockdown.

@vrothberg vrothberg self-assigned this Jun 23, 2020
@vrothberg vrothberg added kind/feature A request for, or a PR adding, new functionality and removed help wanted labels Jun 23, 2020
vrothberg added a commit to vrothberg/image that referenced this issue Jun 29, 2020
Add a `MultiImageArchive{Reader,Writer}` to `docker/archive` to support
docker archives with more than one image.

To allow the new archive reader/writer to be used for copying images,
add an `Image{Destination,Source}` to `copy.Options`.  When set, the
destination/source referenced will be ignored and the specified
`Image{Destination,Source}` will be used instead.

Fixes: containers#610
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
@mtrmac
Copy link
Collaborator

mtrmac commented Aug 8, 2020

#996 implements this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature A request for, or a PR adding, new functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants