docker

package
v0.0.0-...-5a52dbf Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPlatform string = "linux/amd64"

Variables

This section is empty.

Functions

func SplitDockerImage

func SplitDockerImage(fullImg string) (name string, tag string)

SplitDockerImage splits the image into the name and tag. If the image does not have a tag or is invalid, the full string is returned as name, and tag will be empty.

Types

type Cli

type Cli struct {
	// contains filtered or unexported fields
}

func NewCli

func NewCli(commandRunner exec.CommandRunner) *Cli

func (*Cli) Build

func (d *Cli) Build(
	ctx context.Context,
	cwd string,
	dockerFilePath string,
	platform string,
	target string,
	buildContext string,
	tagName string,
	buildArgs []string,
	buildSecrets []string,
	buildEnv []string,
	buildProgress io.Writer,
) (string, error)

Runs a Docker build for a given Dockerfile, writing the output of docker build to [stdOut] when it is not nil. If the platform is not specified (empty) it defaults to amd64. If the build is successful, the function returns the image id of the built image.

func (*Cli) CheckInstalled

func (d *Cli) CheckInstalled(ctx context.Context) error

func (*Cli) Inspect

func (d *Cli) Inspect(ctx context.Context, imageName string, format string) (string, error)

func (*Cli) InstallUrl

func (d *Cli) InstallUrl() string

func (*Cli) Login

func (d *Cli) Login(ctx context.Context, loginServer string, username string, password string) error

func (*Cli) Name

func (d *Cli) Name() string

func (*Cli) Pull

func (d *Cli) Pull(ctx context.Context, imageName string) error

func (*Cli) Push

func (d *Cli) Push(ctx context.Context, cwd string, tag string) error

func (*Cli) Tag

func (d *Cli) Tag(ctx context.Context, cwd string, imageName string, tag string) error

type ContainerImage

type ContainerImage struct {
	// The registry name
	Registry string `json:"registry,omitempty"`
	// The repository name or path
	Repository string `json:"repository,omitempty"`
	// The tag
	Tag string `json:"tag,omitempty"`
}

ContainerImage represents a container image and its components

func ParseContainerImage

func ParseContainerImage(image string) (*ContainerImage, error)

func (*ContainerImage) Local

func (ci *ContainerImage) Local() string

Local returns the local image name without registry

func (*ContainerImage) Remote

func (ci *ContainerImage) Remote() string

Remote returns the remote image name with registry when specified

Jump to

Keyboard shortcuts

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