Skip to content

oras push: support streamed uploading from stdin #1200

Not planned

Description

@qweeah

Are there any plans to implement this also for the input so that something like the following will be possible:

command-a | command-b | oras push localhost:5000/json-artifact:v1 -

...

oras pull localhost:5000/json-artifact:v1 --output - | jq

Originally posted by @ProbstDJakob in #346 (comment)

Activity

  1. added
    enhancement
    question
    on Dec 11, 2023
  2. qweeah commented on Dec 11, 2023

    @qweeah
    ContributorAuthor

    Regarding the user experience, here are some to-be-settled designs we need to think of:

    1. How should user provide the name of the blob from stdin?
    2. Besides from tar -c ...., what are the possible commands that can generate the to-be-uploaded stdin? (Asking since oras push <artifact> <folder> can already natively tar and upload the <folder> without invoking tar)
  3. added
    triage
    on Dec 11, 2023
  4. ProbstDJakob commented on Dec 11, 2023

    @ProbstDJakob

    The following script is a real world example where streaming could come in handy.

    Background

    We fully manage the life cycle of an OpenShift cluster via a GitLab Pipeline. When creating a cluster with the openshift-install tool some files like terraform state and kube-configs will be created. Those files are needed during the whole life cycle of the cluster (not only in the current pipeline), thus they need to be stored persistently. In our case we use the existing GitLab registry and oras to create an image.

    Current way to push the artifacts to the registry

    #!/usr/bin/env sh
    set -eu
    
    # [...] some preparations
    
    git ls-tree --name-only -r --full-tree HEAD "$CI_PROJECT_DIR/openshift-install" \
      | tar -czC "$CI_PROJECT_DIR" --exclude-from=- openshift-install \
      | sops --encrypt --input-type binary --output-type binary --output "$CI_PROJECT_DIR/openshift-install-artifacts.tar.gz.enc" /dev/stdin
    
    cd "$CI_PROJECT_DIR"
    oras push "$ENCRYPTED_OPENSHIFT_INSTALL_ARTIFACTS_IMAGE" openshift-install-artifacts.tar.gz.enc

    Possible way to push the artifacts to the registry with pipelining

    #!/usr/bin/env sh
    set -eu
    
    # [...] some preparations
    
    git ls-tree --name-only -r --full-tree HEAD "$CI_PROJECT_DIR/openshift-install" \
      | tar -czC "$CI_PROJECT_DIR" --exclude-from=- openshift-install \
      | sops --encrypt --input-type binary --output-type binary /dev/stdin \
      | oras push "$ENCRYPTED_OPENSHIFT_INSTALL_ARTIFACTS_IMAGE" -

    This way there is no need to create a temporary file and make sure to be in the correct directory in order to include the file without an absolute path which would make the image unable to unpack in other environments (OSs).

    Counterpart

    See #346 (comment)

  5. removed
    triage
    on Dec 12, 2023
  6. added this to the future milestone on Dec 12, 2023
  7. guettli commented on Jun 2, 2025

    @guettli

    I am interested in that, too.

  8. FeynmanZhou commented on Jun 5, 2025

    @FeynmanZhou
    Member

    Pipelining the stin into oras push sounds like a common scenario now. Thanks @guettli @ProbstDJakob for sharing your use cases.

    @guettli or @ProbstDJakob are you interested in contributing to this feature?

  9. FeynmanZhou commented on Jun 9, 2025

    @FeynmanZhou
    Member

    Hi @guettli , per our slack communication, I just assigned this issue to you. I look forward to working with you to get this feature request supported in ORAS. Let me know if anything that I could help. Thanks

  10. ProbstDJakob commented on Jun 9, 2025

    @ProbstDJakob

    I was just writing to be willing to take it, but as I am unsure when I have time for it, this may be the best solution. A few things I thought about:

    My approach would be to specially handle the file name - as stdin and it could only be specified once (alongside other files from the filesystem). The default file name in the container image would be ./stdin.bin but it could be changed (including the path) with the @ suffix (e.g. -@/absolute/path/to/file.json or -@relative/path/to/file.txt:application/vnd.me.file).

    As this is coupled with the issue #346 I would develop that in a way it would support also containers with multiple files. The command oras pull could then support selecting files to pull as argument similar to tar -x file/one.txt file/two.txt. If no files are given, all would be extracted and if there is only one the stdout would be a valid destination, otherwise one file must be selected via the args.
    If this is an acceptable approach, I would also comment it to the corresponding issue.

  11. guettli commented on May 7, 2026

    @guettli

    I never asigned myself to the task, and I found no way to unasign me...

    BTW afaik regctl can do streamed uploading.

  12. ShravanthReddy commented on Nov 11, 2026

    @ShravanthReddy
    Contributor

    I'd like to take this. The library side is now in place: oras-go v3.0.0 ships content.UnsafePusher (#1616, #1620, #1636, #1637 and #1647 in oras-go, which I wrote), so the CLI can stream stdin to a registry or OCI layout and compute the digest and size while writing. My plan, with a working branch:

    • oras push <ref> [files...] - reads one file from stdin. It's named with --stdin-name <name> or a title annotation for "-" in --annotation-file, which answers the naming question raised above; there's no silent default, since an untitled layer would be skipped by oras pull. A custom media type is given as -:<type>, which needs -- first because pflag reads -: as a flag.
    • oras blob push <ref> - no longer requires --size or a digest. A supplied digest is still verified.
    • Limits for now: no live progress bar in TTY mode for the stdin layer, and oras-go's 4 GiB MaxUnsafePushBytes default.

    Does that UX work for you, or would you prefer a default name such as stdin.bin (as suggested above) over requiring one?

  13. TerryHowe commented on Nov 28, 2026

    @TerryHowe
    Member

    Superseded by #2409, which restates this request with an evaluation of the current state (oras-go v3 UnsafePusher) and a proposed UX and plan. Please continue the discussion there.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementquestion

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions