package crane
import "github.com/google/go-containerregistry/pkg/crane"
Package crane holds libraries used to implement the crane CLI.
Code:play
Output:Example¶
package main
import (
"fmt"
"github.com/google/go-containerregistry/pkg/crane"
)
func main() {
c := map[string][]byte{
"/binary": []byte("binary contents"),
}
i, _ := crane.Image(c)
d, _ := i.Digest()
fmt.Println(d)
}
sha256:09fb0c6289cefaad8c74c7e5fd6758ad6906ab8f57f1350d9f4eb5a7df45ff8b
Index ¶
- func Append(base v1.Image, paths ...string) (v1.Image, error)
- func Catalog(src string, opt ...Option) (res []string, err error)
- func Config(ref string, opt ...Option) ([]byte, error)
- func Copy(src, dst string, opt ...Option) error
- func Delete(src string, opt ...Option) error
- func Digest(ref string, opt ...Option) (string, error)
- func Export(img v1.Image, w io.Writer) error
- func Image(filemap map[string][]byte) (v1.Image, error)
- func Insecure(o *options)
- func Layer(filemap map[string][]byte) (v1.Layer, error)
- func ListTags(src string, opt ...Option) ([]string, error)
- func Load(path string) (v1.Image, error)
- func Manifest(ref string, opt ...Option) ([]byte, error)
- func Pull(src string, opt ...Option) (v1.Image, error)
- func PullLayer(ref string, opt ...Option) (v1.Layer, error)
- func Push(img v1.Image, dst string, opt ...Option) error
- func Save(img v1.Image, src, path string) error
- func SaveLegacy(img v1.Image, src, path string) error
- func SaveOCI(img v1.Image, path string) error
- func Tag(img, tag string, opt ...Option) error
- type Option
Examples ¶
Functions ¶
func Append ¶
Append reads a layer from path and appends it the the v1.Image base.
func Catalog ¶
Catalog returns the repositories in a registry's catalog.
func Config ¶
Config returns the config file for the remote image ref.
func Copy ¶
Copy copies a remote image or index from src to dst.
func Delete ¶
Delete deletes the remote reference at src.
func Digest ¶
Digest returns the sha256 hash of the remote image at ref.
func Export ¶
Export writes the filesystem contents (as a tarball) of img to w.
func Image ¶
Image creates a image with the given filemaps as its contents. These images are reproducible and consistent. A filemap is a path -> file content map representing a file system.
func Insecure ¶
func Insecure(o *options)
Insecure is an Option that allows image references to be fetched without TLS.
func Layer ¶
Layer creates a layer from a single file map. These layers are reproducible and consistent. A filemap is a path -> file content map representing a file system.
func ListTags ¶
ListTags returns the tags in repository src.
func Load ¶
Load reads the tarball at path as a v1.Image.
func Manifest ¶
Manifest returns the manifest for the remote image or index ref.
func Pull ¶
Pull returns a v1.Image of the remote image src.
func PullLayer ¶
PullLayer returns the given layer from a registry.
func Push ¶
Push pushes the v1.Image img to a registry as dst.
func Save ¶
Save writes the v1.Image img as a tarball at path with tag src.
func SaveLegacy ¶
SaveLegacy writes the v1.Image img as a legacy tarball at path with tag src.
func SaveOCI ¶
SaveOCI writes the v1.Image img as an OCI Image Layout at path. If a layout already exists at that path, it will add the image to the index.
func Tag ¶
Tag adds tag to the remote img.
Types ¶
type Option ¶
type Option func(*options)
Option is a functional option for crane.
func WithPlatform ¶
WithPlatform is an Option to specify the platform.
func WithTransport ¶
func WithTransport(t http.RoundTripper) Option
WithTransport is a functional option for overriding the default transport for remote operations.
Source Files ¶
append.go catalog.go config.go copy.go delete.go digest.go doc.go export.go filemap.go get.go list.go manifest.go options.go pull.go push.go tag.go
- Version
- v0.1.4
- Published
- Oct 22, 2020
- Platform
- js/wasm
- Imports
- 20 packages
- Last checked
- 7 seconds ago –
Tools for package owners.