crane

package
v0.1.3-0...-0b0730e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

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

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append

func Append(base v1.Image, paths ...string) (v1.Image, error)

Append reads a layer from path and appends it the the v1.Image base.

func Catalog

func Catalog(src string, opt ...Option) (res []string, err error)

Catalog returns the repositories in a registry's catalog.

func Config

func Config(ref string, opt ...Option) ([]byte, error)

Config returns the config file for the remote image ref.

func Copy

func Copy(src, dst string, opt ...Option) error

Copy copies a remote image or index from src to dst.

func Delete

func Delete(src string, opt ...Option) error

Delete deletes the remote reference at src.

func Digest

func Digest(ref string, opt ...Option) (string, error)

Digest returns the sha256 hash of the remote image at ref.

func Export

func Export(img v1.Image, w io.Writer) error

Export writes the filesystem contents (as a tarball) of img to w.

func Image

func Image(filemap map[string][]byte) (v1.Image, error)

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

func Layer(filemap map[string][]byte) (v1.Layer, error)

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

func ListTags(src string, opt ...Option) ([]string, error)

ListTags returns the tags in repository src.

func Load

func Load(path string) (v1.Image, error)

Load reads the tarball at path as a v1.Image.

func Manifest

func Manifest(ref string, opt ...Option) ([]byte, error)

Manifest returns the manifest for the remote image or index ref.

func Pull

func Pull(src string, opt ...Option) (v1.Image, error)

Pull returns a v1.Image of the remote image src.

func PullLayer

func PullLayer(ref string, opt ...Option) (v1.Layer, error)

PullLayer returns the given layer from a registry.

func Push

func Push(img v1.Image, dst string, opt ...Option) error

Push pushes the v1.Image img to a registry as dst.

func Save

func Save(img v1.Image, src, path string) error

Save writes the v1.Image img as a tarball at path with tag src.

func SaveLegacy

func SaveLegacy(img v1.Image, src, path string) error

SaveLegacy writes the v1.Image img as a legacy tarball at path with tag src.

func SaveOCI

func SaveOCI(img v1.Image, path string) error

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

func Tag(img, tag string, opt ...Option) error

Tag adds tag to the remote img.

Types

type Option

type Option func(*Options)

Option is a functional option for crane.

func WithTransport

func WithTransport(t http.RoundTripper) Option

WithTransport is a functional option for overriding the default transport for remote operations.

type Options

type Options struct {
	Name   []name.Option
	Remote []remote.Option
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL