Skip to main content

oras attach

Attach files to an existing artifact.

oras attach [flags] --artifact-type=<type> <name>{:<tag>|@<digest>} <file>[:<type>] [...]


Attach file 'hi.txt' with type 'doc/example' to manifest 'hello:v1' in registry 'localhost:5000':

oras attach --artifact-type doc/example localhost:5000/hello:v1 hi.txt

Attach file "hi.txt" with specific media type when building the manifest:

oras attach --artifact-type doc/example --image-spec v1.1-image localhost:5000/hello:v1 hi.txt    # OCI image
oras attach --artifact-type doc/example --image-spec v1.1-artifact localhost:5000/hello:v1 hi.txt # OCI artifact

Attach file "hi.txt" using a specific method for the Referrers API:

oras attach --artifact-type doc/example --distribution-spec v1.1-referrers-api localhost:5000/hello:v1 hi.txt # via API
oras attach --artifact-type doc/example --distribution-spec v1.1-referrers-tag localhost:5000/hello:v1 hi.txt # via tag scheme

Attach file 'hi.txt' and add annotations from file 'annotation.json':

oras attach --artifact-type doc/example --annotation-file annotation.json localhost:5000/hello:v1 hi.txt

Attach an artifact with manifest annotations:

oras attach --artifact-type doc/example --annotation "key1=val1" --annotation "key2=val2" localhost:5000/hello:v1

Attach file 'hi.txt' and add manifest annotations:

oras attach --artifact-type doc/example --annotation "key=val" localhost:5000/hello:v1 hi.txt

Attach file 'hi.txt' and export the pushed manifest to 'manifest.json':

oras attach --artifact-type doc/example --export-manifest manifest.json localhost:5000/hello:v1 hi.txt

Attach file to the manifest tagged 'v1' in an OCI layout folder 'layout-dir':

oras attach --oci-layout --artifact-type doc/example layout-dir:v1 hi.txt


  -a, --annotation stringArray                     manifest annotations
--annotation-file string path of the annotation file
--artifact-type string artifact type
--ca-file string server certificate authority file for the remote registry
--concurrency int concurrency level (default 5)
-d, --debug debug mode
--disable-path-validation skip path validation
--distribution-spec string [Preview] set OCI distribution spec version and API option for target. options: v1.1-referrers-api, v1.1-referrers-tag
--export-manifest path path of the pushed manifest
-H, --header stringArray add custom headers to requests
-h, --help help for attach
--image-spec string [Experimental] specify manifest type for building artifact. options: v1.1-image, v1.1-artifact (default "v1.1-image")
--insecure allow connections to SSL registry without certs
--oci-layout set target as an OCI image layout
-p, --password string registry password or identity token
--password-stdin read password or identity token from stdin
--plain-http allow insecure connections to registry without SSL check
--registry-config path path of the authentication file for registry
--resolve host:port:address[:address_port] customized DNS for registry, formatted in host:port:address[:address_port]
-u, --username string registry username
-v, --verbose verbose output