Help us shape the future of Go! Take the 2026 Go Developer Survey

container

package
v2.60.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: Apache-2.0 Imports: 25 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Pull CommandType = "pull"
	Push CommandType = "push"

	ManifestJsonFile                  = "manifest.json"
	AttestationsModuleIdPrefix string = "attestations"
)
View Source
const LoginFailureMessage string = "%s login failed for: %s.\n%s image must be in the form: registry-domain/path-in-repository/image-name:version."

Docker login error message

View Source
const MinSupportedApiVersion string = "1.31"

Docker API version 1.31 is compatible with Docker version 17.07.0, according to https://docs.docker.com/engine/api/#api-version-matrix

Variables

View Source
var ApiVersionRegex = regexp.MustCompile(`^(\d+)\.(\d+)$`)

Search for docker API version format pattern e.g. 1.40

Functions

func ContainerManagerLogin

func ContainerManagerLogin(imageRegistry string, config *ContainerManagerLoginConfig, containerManager ContainerManagerType) error

First we'll try to log in assuming a proxy-less tag (e.g. "registry-address/docker-repo/image:ver"). If fails, we will try assuming a reverse proxy tag (e.g. "registry-address-docker-repo/image:ver").

func NewLocalAgentBuildInfoBuilder added in v2.8.0

func NewLocalAgentBuildInfoBuilder(image *Image, repository, buildName, buildNumber, project string, serviceManager artifactory.ArtifactoryServicesManager, commandType CommandType, containerManager ContainerManager) (*localAgentBuildInfoBuilder, error)

Create new build info builder container CLI tool

func ValidateClientApiVersion

func ValidateClientApiVersion() error

Types

type Annotations added in v2.54.2

type Annotations struct {
	ReferenceDigest string `json:"vnd.docker.reference.digest"`
	ReferenceType   string `json:"vnd.docker.reference.type"`
}

Annotations for attestation manifests.

type Builder

type Builder interface {
	Build(module string) (*buildinfo.BuildInfo, error)
	UpdateArtifactsAndDependencies() error
	GetLayers() *[]utils.ResultItem
}

Docker image build info builder.

type CommandType

type CommandType string

type ContainerManager

type ContainerManager interface {
	// Image ID is basically the image's SHA256
	Id(image *Image) (string, error)
	OsCompatibility(image *Image) (string, string, error)
	RunNativeCmd(cmdParams []string) error
	GetContainerManagerType() ContainerManagerType
}

Container image

func NewManager

func NewManager(containerManagerType ContainerManagerType) ContainerManager

type ContainerManagerLoginConfig

type ContainerManagerLoginConfig struct {
	ServerDetails *config.ServerDetails
}

type ContainerManagerType

type ContainerManagerType int
const (
	DockerClient ContainerManagerType = iota
	Podman
)

func (ContainerManagerType) String

func (cmt ContainerManagerType) String() string

type FatManifest

type FatManifest struct {
	Manifests []ManifestDetails `json:"manifests"`
}

type Image

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

func GetImageTagWithDigest

func GetImageTagWithDigest(filePath string) (*Image, string, error)

Read the file which contains the following format: 'IMAGE-TAG-IN-ARTIFACTORY'@sha256'SHA256-OF-THE-IMAGE-MANIFEST'.

func NewImage

func NewImage(imageTag string) *Image

func (*Image) GetImageLongName added in v2.10.0

func (image *Image) GetImageLongName() (string, error)

Get image base name by removing the prefixed registry hostname and the tag. e.g.: https://my-registry/docker-local/hello-world:latest. -> docker-local/hello-world

func (*Image) GetImageLongNameWithTag added in v2.10.0

func (image *Image) GetImageLongNameWithTag() (string, error)

Get image name from tag by removing the prefixed registry hostname. e.g.: https://my-registry/docker-local/hello-world:latest. -> docker-local/hello-world:latest

func (*Image) GetImageLongNameWithoutRepoWithTag added in v2.56.5

func (image *Image) GetImageLongNameWithoutRepoWithTag() (string, error)

GetImageLongNameWithoutRepoWithTag removes the registry hostname and repository name, returning the organization and image name with the tag. e.g., "docker-local/myorg/hello-world:latest" -> "myorg/hello-world:latest" e.g., "docker-local/hello-world:latest" -> "hello-world:latest"

func (*Image) GetImageShortName added in v2.10.0

func (image *Image) GetImageShortName() (string, error)

Get image base name by removing the prefixed registry hostname and the tag. e.g.: https://my-registry/docker-local/hello-world:latest. -> hello-world

func (*Image) GetImageShortNameWithTag added in v2.10.0

func (image *Image) GetImageShortNameWithTag() (string, error)

Get image base name by removing the prefixed registry hostname. e.g.: https://my-registry/docker-local/hello-world:latest. -> hello-world:latest

func (*Image) GetImageTag added in v2.10.0

func (image *Image) GetImageTag() (string, error)

Get image tag name of an image. e.g.: https://my-registry/docker-local/hello-world:latest. -> latest

func (*Image) GetRegistry added in v2.10.0

func (image *Image) GetRegistry() (string, error)

func (*Image) GetRemoteRepo added in v2.10.0

func (image *Image) GetRemoteRepo(serviceManager artifactory.ArtifactoryServicesManager) (string, error)

Returns the physical Artifactory repository name of the pulled/pushed image, by reading a response header from Artifactory.

func (*Image) Name

func (image *Image) Name() string

Get image name

type LoginCmd

type LoginCmd struct {
	DockerRegistry string
	Username       string
	Password       string
	// contains filtered or unexported fields
}

Login command

func (*LoginCmd) GetCmd

func (loginCmd *LoginCmd) GetCmd() *exec.Cmd

func (*LoginCmd) RunCmd added in v2.1.0

func (loginCmd *LoginCmd) RunCmd() error

type ManifestDetails

type ManifestDetails struct {
	Digest      string      `json:"digest"`
	Platform    Platform    `json:"platform"`
	Annotations Annotations `json:"annotations"`
}

type Platform

type Platform struct {
	Architecture string `json:"architecture"`
	Os           string `json:"os"`
}

type RemoteAgentBuildInfoBuilder added in v2.33.0

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

Build-info builder for remote agents tools such as: Kaniko, OpenShift CLI (oc), or buildx.

func NewRemoteAgentBuildInfoBuilder added in v2.8.0

func NewRemoteAgentBuildInfoBuilder(image *Image, repository, buildName, buildNumber, project string, serviceManager artifactory.ArtifactoryServicesManager, manifestSha256 string) (*RemoteAgentBuildInfoBuilder, error)

func (*RemoteAgentBuildInfoBuilder) Build added in v2.33.0

func (rabib *RemoteAgentBuildInfoBuilder) Build(module string) (*buildinfo.BuildInfo, error)

func (*RemoteAgentBuildInfoBuilder) GetLayers added in v2.33.0

func (rabib *RemoteAgentBuildInfoBuilder) GetLayers() *[]utils.ResultItem

type RepositoryDetails

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

type VersionCmd

type VersionCmd struct{}

Version command Docker-client provides an API for interacting with the Docker daemon. This cmd should be used for docker client only.

func (*VersionCmd) GetCmd

func (versionCmd *VersionCmd) GetCmd() *exec.Cmd

func (*VersionCmd) RunCmd added in v2.1.0

func (versionCmd *VersionCmd) RunCmd() (string, error)

Jump to

Keyboard shortcuts

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