docker

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: Apache-2.0 Imports: 49 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Name = "Docker"

Name is the name of the Docker builder

View Source
var (
	NewAPIClient = NewAPIClientImpl
)

For testing

View Source
var (
	RemoteDigest = getRemoteDigest
)

for testing

View Source
var (
	// RetrieveImage is overridden for unit testing
	RetrieveImage = retrieveImage
)
View Source
var (
	ValidateDockerfileFunc = ValidateDockerfile
)

For testing

Functions

func AddRemoteTag added in v0.34.0

func AddRemoteTag(src, target string, insecureRegistries map[string]bool) error

func CreateDockerTarContext

func CreateDockerTarContext(ctx context.Context, w io.Writer, workspace string, a *latest.DockerArtifact, insecureRegistries map[string]bool) error

func EvaluateBuildArgs added in v0.33.0

func EvaluateBuildArgs(args map[string]*string) (map[string]*string, error)

EvaluateBuildArgs evaluates templated build args.

func GetBuildArgs added in v0.11.0

func GetBuildArgs(a *latest.DockerArtifact) ([]string, error)

GetBuildArgs gives the build args flags for docker build.

func GetDependencies added in v0.7.0

func GetDependencies(ctx context.Context, workspace string, dockerfilePath string, buildArgs map[string]*string, insecureRegistries map[string]bool) ([]string, error)

GetDependencies finds the sources dependencies for the given docker artifact. All paths are relative to the workspace.

func IsInsecure added in v0.37.0

func IsInsecure(reg string, insecureRegistries map[string]bool) bool

IsInsecure tests if the registry is listed as an insecure registry; default is false

func NormalizeDockerfilePath added in v0.11.0

func NormalizeDockerfilePath(context, dockerfile string) (string, error)

NormalizeDockerfilePath returns the absolute path to the dockerfile.

func Push added in v0.34.0

func Push(tarPath, tag string, insecureRegistries map[string]bool) (string, error)

Push pushes the tarball image

func RetrieveRemoteConfig added in v0.24.0

func RetrieveRemoteConfig(identifier string, insecureRegistries map[string]bool) (*v1.ConfigFile, error)

RetrieveRemoteConfig retrieves the remote config file for an image

func RetrieveWorkingDir added in v0.32.0

func RetrieveWorkingDir(tagged string, insecureRegistries map[string]bool) (string, error)

func SubstituteDefaultRepoIntoImage added in v1.0.0

func SubstituteDefaultRepoIntoImage(defaultRepo string, image string) (string, error)

func SyncMap added in v0.32.0

func SyncMap(ctx context.Context, workspace string, dockerfilePath string, buildArgs map[string]*string, insecureRegistries map[string]bool) (map[string][]string, error)

SyncMap creates a map of syncable files by looking at the COPY/ADD commands in the Dockerfile. All keys are relative to the Skaffold root, the destinations are absolute container paths. TODO(corneliusweig) destinations are not resolved across stages in multistage dockerfiles. Is there a use-case for that?

func ValidateDockerfile added in v0.14.0

func ValidateDockerfile(path string) bool

ValidateDockerfile makes sure the given Dockerfile is existing and valid.

func WalkWorkspace added in v0.29.0

func WalkWorkspace(workspace string, excludes, deps []string) (map[string]bool, error)

WalkWorkspace walks the given host directories and records all files found. Note: if you change this function, you might also want to modify `walkWorkspaceWithDestinations`.

Types

type AuthConfigHelper

type AuthConfigHelper interface {
	GetAuthConfig(registry string) (types.AuthConfig, error)
	GetAllAuthConfigs() (map[string]types.AuthConfig, error)
}

AuthConfigHelper exists for testing purposes since GetAuthConfig shells out to native store helpers. Ideally this shouldn't be public, but the LocalBuilder needs to use it.

var (
	// DefaultAuthHelper is exposed so that other packages can override it for testing
	DefaultAuthHelper AuthConfigHelper
)

type BuildResult added in v0.21.0

type BuildResult struct {
	ID string
}

BuildResult gives the information on an image that has been built.

type ContainerRun added in v1.0.0

type ContainerRun struct {
	Image       string
	User        string
	Command     []string
	Mounts      []mount.Mount
	BeforeStart func(context.Context, string) error
}

type Docker added in v0.33.0

type Docker struct {
	File string `json:"path"`
}

Docker is the path to a dockerfile. Implements the InitBuilder interface.

func (Docker) ConfiguredImage added in v0.33.0

func (d Docker) ConfiguredImage() string

ConfiguredImage returns the target image configured by the builder, or an empty string if no image is configured

func (Docker) CreateArtifact added in v0.33.0

func (d Docker) CreateArtifact(manifestImage string) *latest.Artifact

CreateArtifact creates an Artifact to be included in the generated Build Config

func (Docker) Describe added in v0.33.0

func (d Docker) Describe() string

Describe returns the initBuilder's string representation, used when prompting the user to choose a builder.

func (Docker) Name added in v0.33.0

func (d Docker) Name() string

Name returns the name of the builder, "Docker"

func (Docker) Path added in v0.33.0

func (d Docker) Path() string

Path returns the path to the dockerfile

type ImageReference added in v0.7.0

type ImageReference struct {
	BaseName       string
	Domain         string
	Path           string
	Tag            string
	Digest         string
	FullyQualified bool
}

ImageReference is a parsed image name.

func ParseReference added in v0.7.0

func ParseReference(image string) (*ImageReference, error)

ParseReference parses an image name to a reference.

type LocalDaemon added in v0.21.0

type LocalDaemon interface {
	Close() error
	ExtraEnv() []string
	ServerVersion(ctx context.Context) (types.Version, error)
	ConfigFile(ctx context.Context, image string) (*v1.ConfigFile, error)
	Build(ctx context.Context, out io.Writer, workspace string, a *latest.DockerArtifact, ref string) (string, error)
	Push(ctx context.Context, out io.Writer, ref string) (string, error)
	Pull(ctx context.Context, out io.Writer, ref string) error
	Load(ctx context.Context, out io.Writer, input io.Reader, ref string) (string, error)
	Tag(ctx context.Context, image, ref string) error
	TagWithImageID(ctx context.Context, ref string, imageID string) (string, error)
	ImageID(ctx context.Context, ref string) (string, error)
	ImageInspectWithRaw(ctx context.Context, image string) (types.ImageInspect, []byte, error)
	ImageRemove(ctx context.Context, image string, opts types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error)
	ImageExists(ctx context.Context, ref string) bool
	Prune(ctx context.Context, out io.Writer, images []string, pruneChildren bool) error
	ContainerRun(ctx context.Context, out io.Writer, runs ...ContainerRun) error
	CopyToContainer(ctx context.Context, container string, dest string, root string, paths []string) error
	VolumeRemove(ctx context.Context, volumeID string, force bool) error
}

LocalDaemon talks to a local Docker API.

func NewAPIClientImpl added in v0.35.0

func NewAPIClientImpl(runCtx *runcontext.RunContext) (LocalDaemon, error)

NewAPIClientImpl guesses the docker client to use based on current Kubernetes context.

func NewLocalDaemon added in v0.21.0

func NewLocalDaemon(apiClient client.CommonAPIClient, extraEnv []string, forceRemove bool, insecureRegistries map[string]bool) LocalDaemon

NewLocalDaemon creates a new LocalDaemon.

type PushResult added in v0.21.0

type PushResult struct {
	Digest string
}

PushResult gives the information on an image that has been pushed.

Jump to

Keyboard shortcuts

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