image

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2017 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package image contains methods and helpers for parsing the docker image format. Unfortunately, Docker's codebase does not provide a simple library for encoding/decoding the string representation of an image into a consistent structure.

The general format is:

NAME[:TAG|@DIGEST]

Example:

ubuntu:14.04
localhost.localdomain:5000/samalba/hipache:latest
localhost:5000/foo/bar@sha256:bc8813ea7b3603864987522f02a76101c17ad122e1c46d790efc0fca78ca7bfb

Index

Constants

View Source
const DefaultTag = "latest"

DefaultTag is used when json decoding an image. If there is no tag part present, this will be used as the tag.

Variables

View Source
var ErrInvalidImage = errors.New("image: invalid")

ErrInvalidImage is returned when the image does not specify a repo.

Functions

func Encode

func Encode(image Image) string

Encode encodes an Image to it's string representation.

Types

type Image

type Image struct {
	// Registry is the registry that the image belongs to.
	Registry string

	// Repository is the repository part of the image.
	Repository string

	// If provided a tag.
	Tag string

	// If provided, a digest for the image.
	Digest string
}

Image represents all the information about an image.

func Decode

func Decode(in string) (image Image, err error)

Decode decodes the string representation of an image into an Image structure.

func (*Image) Scan

func (i *Image) Scan(src interface{}) error

Scan implements the sql.Scanner interface.

func (Image) String

func (i Image) String() string

func (*Image) UnmarshalJSON

func (i *Image) UnmarshalJSON(b []byte) error

func (Image) Value

func (i Image) Value() (driver.Value, error)

Value implements the driver.Value interface.

Jump to

Keyboard shortcuts

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