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

podman save --format oci-dir should be able to create a tagged image #20515

Closed
amluto opened this issue Oct 27, 2023 · 7 comments
Closed

podman save --format oci-dir should be able to create a tagged image #20515

amluto opened this issue Oct 27, 2023 · 7 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@amluto
Copy link

amluto commented Oct 27, 2023

Feature request description

Tools that use OCI image directories seem to generally expect that the images intended for direct use are tagged. For example, umoci seems to be entirely incapable of working with untagged images (opencontainers/umoci#511).

But podman save does not appear to be able to tag its output. For example:

$ podman save --format=oci-dir <hash> -o <directory name>

does not result in an org.opencontainers.image.ref.name annotation.

skopeo can do this:

$ skopeo copy containers-storage:<hash> oci:<dir>:<tag>

Suggest potential solution

A couple of options come to mind:

podman could support colon-delimited syntax, like this:

$ podman save --format=oci-dir <hash> -o <directory name>:<tag>

Or podman-save.1 could suggest using skopeo for this purpose.

Have you considered any alternatives?

Yes -- as above, skopeo can solve this particular problem.

Additional context

No response

@amluto amluto added the kind/feature Categorizes issue or PR as related to a new feature. label Oct 27, 2023
@rhatdan
Copy link
Member

rhatdan commented Oct 27, 2023

@vrothberg @mtrmac PTAL

@vrothberg
Copy link
Member

podman save inherited the UI from Docker which I personally find limited in flexibility. Instead of podman save, I suggest using podman push which works with a specified source and destination:

podman push <hash> oci:/tmp/foo:12345 will create an OCI image with the specified tag.

@amluto
Copy link
Author

amluto commented Oct 28, 2023

Nifty. Might I suggest that the podman-save manpage be updated to suggest using push instead and perhaps even to note that save fails to emit tags?

@rhatdan
Copy link
Member

rhatdan commented Oct 29, 2023

Please open a PR to make the change, I would also suggest that you meantion the change in both podman save and podman push man pages.

@vrothberg
Copy link
Member

Nifty. Might I suggest that the podman-save manpage be updated to suggest using push instead and perhaps even to note that save fails to emit tags?

podman save does not emit tags. If you do a podman save [...] registry.com/repo/image:tag the tag will be preserved. But if the image is being referenced via its digest, there is just no specified tag to preserve.

Are you interested in opening a PR for that? If not, we can follow up.

@amluto
Copy link
Author

amluto commented Oct 29, 2023

Please open a PR to make the change, I would also suggest that you meantion the change in both podman save and podman push man pages.

Will do (probably tomorrow). I wrote a first draft of the podman save part:

https://github.com/amluto/podman/tree/save-docs

podman save does not emit tags. If you do a podman save [...] registry.com/repo/image:tag the tag will be preserved. But if the image is being referenced via its digest, there is just no specified tag to preserve.

Are you interested in opening a PR for that? If not, we can follow up.

Maybe? The current semantics are far from clear to me, and I have no idea whether the current semantics are intentional (or are intentional in the sense of bug-for-bug compatibility with Docker). Are you saying that, if the image being saved is already tagged, then podman save will copy the literal tag name to the destination?

Perhaps someone familiar with the current and intended semantics of podman save should be the one to document it :)

@vrothberg
Copy link
Member

Are you saying that, if the image being saved is already tagged, then podman save will copy the literal tag name to the destination?

Yes, if you replace the input image <hash> with <something-tagged> the latter will be preserved. In your specific case, there is no tag, so save doesn't preserve it.

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Jan 29, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

3 participants