Skip to content

Add new commands to support uploading and downloading images #1366

Description

@qweeah

What is the version of your ORAS CLI

oras v1.1.0

What would you like to be added?

Had an offline discussion with @shizhMSFT and he suggests to add two commands:

  • oras backup (alias: snapshot, pull-image) to support saving an image from remote registry to an OCI image layout tar archive.
Usage:
  oras backup --output <oci_layout_path> <reg>/<repo>[{:<tag>|@digest]}] [...]
  • oras restore (alias: push-image) to support pushing an image from an OCI image layout tar archive to remote registry.
Usage:
  oras restore --output <reg>/<repo> <oci_layout_path>[{:<tag>|@digest]}]

Why is this needed for ORAS?

oras cp is not intuitive to use, e.g. user might use oras push to push images from an OCI layout and succeed with false positive (see #1353). Adding those two wrapper commands of oras cp can help avoid that.

Are you willing to submit PRs to contribute to this feature?

  • Yes, I am willing to implement it.

Activity

  1. added
    enhancement
    triage
    on Apr 23, 2024
  2. TerryHowe commented on Apr 23, 2024

    @TerryHowe
    Member
  3. shizhMSFT commented on Apr 24, 2024

    @shizhMSFT
    Contributor

    Why not backup and restore?

    Nice input. I've revised the proposal accordingly to oras backup and marked snapshot as an alias.

  4. removed
    triage
    on May 7, 2024
  5. added this to the v1.3.0 milestone on May 7, 2024
  6. added
    spec required
    on Jul 24, 2024
  7. sajayantony commented on Jul 24, 2024

    @sajayantony
    Contributor

    Could you also include reasoning why pull doesn't work here.

    oras pull --to-oci-layout <oci_layout_path> <reg>/<repo>[{:<tag>|@digest]}] [...]

  8. sajayantony commented on Jul 24, 2024

    @sajayantony
    Contributor

    As per the call I'm ok if we limit to tar archive only dealing.

  9. shizhMSFT commented on Jul 24, 2024

    @shizhMSFT
    Contributor

    As per the call, here is an alternative without introducing new commands.

    • oras backup --> oras pull --archive <tar_path> <name>{:<tag>|@<digest>}
    • oras restore --> oras push --archive <tar_path> <name>[:<tag>[,<tag>][...]] <file>[:<type>] [...]

    The major difference between oras backup/restore and oras pull/push is that oras backup/restore can take multiple images across registries and repositories.

    Example usages are

    # working with remote registry
    oras pull localhost:5000/hello:v1 --archive hello.tar # backup hello:v1 to hello.tar
    oras push localhost:5000/hello:v1 --archive hello.tar # restore hello:v1 from hello.tar
    
    # working with entire repository
    oras pull localhost:5000/hello --archive hello.tar # backup all images in hello to hello.tar
    oras push localhost:5000/hello --archive hello.tar # restore all images in hello.tar
    
    # working with multiple images
    oras pull localhost:5000/hello:v1,foo,bar --archive hello.tar # backup v1, foo, and bar
    oras push localhost:5000/hello:v1,foo --archive hello.tar     # restore v1 and foo, and ignore bar
    
    # working with referrers
    oras pull --include-referrers localhost:5000/hello:v1 --archive hello.tar
    oras push --include-referrers localhost:5000/hello:v1 --archive hello.tar
    
    # working with OCI layout. UX would be better if using `oras cp`.
    oras pull --oci-layout layout.tar:v1 --archive hello.tar
    oras pull --oci-layout layout-dir:v1 --archive hello.tar
    oras push --oci-layout layout-dir:v1 --archive hello.tar
  10. qweeah commented on Jul 24, 2024

    @qweeah
    ContributorAuthor

    oras restore --> oras push --archive <tar_path> [:[,][...]] [:] [...]

    I think the usage is change to oras push <name>[:<tag>[,<tag>][...]] {<file>[:<type>] [...]|--archive <tar_path>}.

  11. TerryHowe commented on Jul 24, 2024

    @TerryHowe
    Member

    Currently, pull skips successors though, right?

  12. qweeah commented on Jul 24, 2024

    @qweeah
    ContributorAuthor

    Currently, pull skips successors though, right?

    Depends on the type. subject are skipped unless --include-subject is specified. manifests in an index will be pulled.

  13. TerryHowe commented on Oct 5, 2024

    @TerryHowe
    Member

    This issue is what I was requesting on #730

  14. shizhMSFT commented on Oct 6, 2024

    @shizhMSFT
    Contributor

    This issue is what I was requesting on #730

    Yes, exactly. The difference is that the requirements are getting clearer after 1.5 years where more tools, including docker, are adopting OCI image layout.

  15. 6 remaining items

  16. qweeah commented on Oct 9, 2024

    @qweeah
    ContributorAuthor

    Saving(pulling) to a tar file is not supported, but reading(pushing) from a tar file is supported. You may tar the folder after pulling.

  17. liamwh commented on Oct 9, 2024

    @liamwh

    Thanks for clarifying. Is it possible to save to a tar file instead of unpacking the contents to the file system?

  18. TerryHowe commented on Oct 9, 2024

    @TerryHowe
    Member

    Is it possible to save to a tar file instead of unpacking the contents to the file system?

    No

  19. liamwh commented on Oct 14, 2024

    @liamwh

    Please forgive my ignorance, I'm just trying to understand: why not skip the extraction and support just downloading the tar, given that's what an OCI image actually is?

  20. TerryHowe commented on Oct 14, 2024

    @TerryHowe
    Member

    Please forgive my ignorance, I'm just trying to understand: why not skip the extraction and support just downloading the tar, given that's what an OCI image actually is?

    My understanding is that is exactly what this issue is about.

  21. qweeah commented on Oct 14, 2024

    @qweeah
    ContributorAuthor

    why not skip the extraction and support just downloading the tar, given that's what an OCI image actually is?

    @liamwh Image layer files can be tarball and oras will not extract layer files.

    However, the image itself, consisting of layer tarball files and other metadata, is not a tarball. The OCI layout folder won't be compressed by oras.

  22. linked a pull request that will close this issuedocs: backup and restore specification #1610on Jun 10, 2025
  23. added
    duplicate
    on Jun 10, 2025
  24. Wwwsylvia commented on Jul 8, 2025

    @Wwwsylvia
    Member

    Reopening this issue as the implementation is not yet complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

duplicateenhancementspec required

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions