Documentation ¶
Overview ¶
Package crane holds libraries used to implement the crane CLI.
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) }
Output: 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 Optimize(src, dst string, prioritize []string, opt ...Option) 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 ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 Optimize ¶ added in v0.3.0
Optimize optimizes a remote image or index from src to dst. THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE WITHOUT WARNING.
func SaveLegacy ¶
SaveLegacy writes the v1.Image img as a legacy tarball at path with tag src.
Types ¶
type Option ¶
type Option func(*options)
Option is a functional option for crane.
func WithAuth ¶ added in v0.2.0
func WithAuth(auth authn.Authenticator) Option
WithAuth is a functional option for overriding the default authenticator for remote operations.
By default, crane will use authn.DefaultKeychain.
func WithAuthFromKeychain ¶ added in v0.2.0
WithAuthFromKeychain is a functional option for overriding the default authenticator for remote operations, using an authn.Keychain to find credentials.
By default, crane will use authn.DefaultKeychain.
func WithPlatform ¶ added in v0.1.4
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.
func WithUserAgent ¶ added in v0.2.0
WithUserAgent adds the given string to the User-Agent header for any HTTP requests.