docker

package
v0.0.0-...-e2ae3e1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Out            = sh.OutCmd("docker")
	CraneDigestOut = sh.OutCmd("crane", "digest")
)

Functions

func Build

func Build(moduleDir, tag string) error

Build builds a Docker image.

Parameters: moduleDir (string) - the directory of the module, tag (string) - the tag of the image. Returns: error - an error if the operation fails.

func BuildCmd

func BuildCmd(moduleDir, tag string) magelib.Cmd

Build as magelib.Cmd

func BuildWithArgs

func BuildWithArgs(moduleDir, tag string, args magelib.ArgsMap) error

BuildWithArgs builds a Docker image with the specified build arguments and tags it with the given tag.

Parameters: moduleDir (string) - the directory of the module, tag (string) - the tag of the image, args (magelib.ArgsMap) - the build arguments. Returns: error - an error if the operation fails.

func BuildWithArgsCmd

func BuildWithArgsCmd(moduleDir, tag string, args magelib.ArgsMap) magelib.Cmd

BuildWithArgs as magelib.Cmd

func BuildWithFile

func BuildWithFile(moduleDir, dockerfilePath, tag string) error

BuildWithFile builds a Docker image using the specified Dockerfile and tags it with the given tag.

Parameters: - moduleDir: the directory of the module. - dockerfilePath: the path to the Dockerfile. - tag: the tag to give to the Docker image.

Returns: - error: an error if the operation fails.

func BuildWithFileCmd

func BuildWithFileCmd(moduleDir, dockerfilePath, tag string) magelib.Cmd

BuildWithFile as magelib.Cmd

func ContainerNameByLabel

func ContainerNameByLabel(label string) (string, error)

ContainerNameByLabel gets the name of a Docker container by its label.

Parameters: label (string) - the label of the Docker container. Returns: name (string) - the name of the Docker container, err (error) - an error if the operation fails.

func ImageDigestLocal

func ImageDigestLocal(tag string) (string, error)

ImageDigestLocal retrieves the digest of a Docker image with the given tag on the local machine.

Parameters: - tag: the tag of the Docker image.

Returns: - string: the digest of the Docker image. - error: an error if the operation fails.

func ImageDigestRemote

func ImageDigestRemote(tag string) (string, error)

ImageDigestRemote retrieves the digest of a Docker image with the given tag remotely.

Parameters: - tag (string): the tag of the Docker image.

Returns: - string: the digest of the Docker image. - error: an error if the operation fails.

func IsImageAvailable

func IsImageAvailable(imageName string) bool

IsImageAvailable checks if a Docker image is available on the local machine.

Parameters: - imageName (string): the name of the Docker image to check.

Returns: - bool: true if the image is available, false otherwise.

func Push

func Push(tag string) error

Push pushes a Docker image with the given tag.

Parameters: - tag: the tag of the Docker image to push.

Returns: - error: an error if the push operation fails.

func PushCmd

func PushCmd(tag string) magelib.Cmd

PushCmd returns a magelib.Cmd that pushes a Docker image with the given tag.

Parameters: - tag (string): the tag of the Docker image to push.

Returns: - magelib.Cmd: a function that returns an error if the push operation fails.

func PushOnDemand

func PushOnDemand(tag string) error

PushOnDemand pushes a Docker image with the given tag only if the local and remote digests do not match.

Parameters: - tag (string): the tag of the Docker image.

Returns: - error: an error if the push operation fails.

func PushOnDemandCmd

func PushOnDemandCmd(tag string) magelib.Cmd

PushOnDemandCmd returns a magelib.Cmd that pushes a Docker image with the given tag only if the local and remote digests do not match.

Parameters: - tag (string): the tag of the Docker image.

Returns: - magelib.Cmd: a function that returns an error if the push operation fails.

func RemoveLocalImage

func RemoveLocalImage(imageName string) error

RemoveLocalImage removes a local Docker image.

Parameters: - imageName (string): the name of the Docker image to remove.

Returns: - error: an error if the removal operation fails.

func RemoveLocalImageCmd

func RemoveLocalImageCmd(imageName string) magelib.Cmd

RemoveLocalImage as magelib.Cmd

func RemoveUntaggedImages

func RemoveUntaggedImages() error

RemoveUntaggedImages removes untagged Docker images.

No parameters. Returns an error if the operation fails.

func RemoveUntaggedImagesCmd

func RemoveUntaggedImagesCmd() magelib.Cmd

RemoveUntaggedImages as magelib.Cmd

Types

This section is empty.

Jump to

Keyboard shortcuts

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