docker

package
v0.4.2-alpha6 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

credit: https://github.com/containrrr/watchtower

credit: https://github.com/containrrr/watchtower

credit: https://github.com/containrrr/watchtower

credit: https://github.com/containrrr/watchtower

credit: https://github.com/containrrr/watchtower

credit: https://github.com/containrrr/watchtower

credit: https://github.com/containrrr/watchtower

credit: https://github.com/containrrr/watchtower

Index

Constants

View Source
const ChallengeHeader = "WWW-Authenticate"

ChallengeHeader is the HTTP Header containing challenge instructions

View Source
const ContentDigestHeader = "Docker-Content-Digest"

ContentDigestHeader is the key for the key-value pair containing the digest header

View Source
const NETWORKNAME = "oasis"

Variables

This section is empty.

Functions

func BuildManifestURL added in v0.4.2

func BuildManifestURL(imageName string) (string, error)

BuildManifestURL from raw image data

func CloneContainer added in v0.4.2

func CloneContainer(ctx context.Context, id string, newName string) (string, error)

func CompareDigest added in v0.4.2

func CompareDigest(imageName string, repoDigests []string, registryAuth string) (bool, error)

CompareDigest ...

func Container added in v0.4.2

func Container(ctx context.Context, id string) (*types.ContainerJSON, error)

func ConvertToHostname added in v0.4.2

func ConvertToHostname(url string) (string, string, error)

ConvertToHostname strips a url from everything but the hostname part

func CredentialsStore added in v0.4.2

func CredentialsStore(configFile configfile.ConfigFile) credentials.Store

CredentialsStore returns a new credentials store based on the settings provided in the configuration file.

func CurrentArchitecture added in v0.4.2

func CurrentArchitecture() (string, error)

func EncodeAuth added in v0.4.2

func EncodeAuth(authConfig types.AuthConfig) (string, error)

EncodeAuth Base64 encode an AuthConfig struct for transmission over HTTP

func EncodedAuth added in v0.4.2

func EncodedAuth(ref string) (string, error)

EncodedAuth returns an encoded auth config for the given registry loaded from environment variables or docker config as available in that order

func EncodedConfigAuth added in v0.4.2

func EncodedConfigAuth(ref string) (string, error)

EncodedConfigAuth returns an encoded auth config for the given registry loaded from the docker config Returns an empty string if credentials cannot be found for the referenced server The docker config must be mounted on the container

func EncodedEnvAuth added in v0.4.2

func EncodedEnvAuth(ref string) (string, error)

EncodedEnvAuth returns an encoded auth config for the given registry loaded from environment variables Returns an error if authentication environment variables have not been set

func ExtractImageAndTag added in v0.4.2

func ExtractImageAndTag(imageName string) (string, string)

ExtractImageAndTag from a concatenated string

func GetAuthURL added in v0.4.2

func GetAuthURL(challenge string, img string) (*url.URL, error)

GetAuthURL from the instructions in the challenge

func GetBearerHeader added in v0.4.2

func GetBearerHeader(challenge string, img string, registryAuth string) (string, error)

GetBearerHeader tries to fetch a bearer token from the registry based on the challenge instructions

func GetChallenge added in v0.4.2

func GetChallenge(imageName string) (string, error)

GetChallenge fetches a challenge for the registry hosting the provided image

func GetChallengeRequest added in v0.4.2

func GetChallengeRequest(URL url.URL) (*http.Request, error)

GetChallengeRequest creates a request for getting challenge instructions

func GetChallengeURL added in v0.4.2

func GetChallengeURL(img string) (url.URL, error)

GetChallengeURL creates a URL object based on the image info

func GetDigest added in v0.4.2

func GetDigest(url string, token string) (string, error)

GetDigest from registry using a HEAD request to prevent rate limiting

func GetDir

func GetDir(id, envName string) string

func GetPullOptions added in v0.4.2

func GetPullOptions(imageName string) (types.ImagePullOptions, error)

GetPullOptions creates a struct with all options needed for pulling images from a registry

func GetScopeFromImageName added in v0.4.2

func GetScopeFromImageName(img, svc string) string

GetScopeFromImageName normalizes an image name for use as scope during auth and head requests

func GetToken added in v0.4.2

func GetToken(challenge string, registryAuth string, imageName string) (string, error)

func HasNewImage added in v0.4.2

func HasNewImage(ctx context.Context, imageName string, currentImageID string) (bool, string, error)

func Image added in v0.4.2

func Image(ctx context.Context, imageName string) (*types.ImageInspect, error)

func ImageName added in v0.4.2

func ImageName(containerInfo *types.ContainerJSON) string

func IsDaemonRunning added in v0.4.2

func IsDaemonRunning() bool

func NormalizeRegistry added in v0.4.2

func NormalizeRegistry(registry string) (string, error)

NormalizeRegistry makes sure variations of DockerHubs registry

func ParseServerAddress added in v0.4.2

func ParseServerAddress(ref string) (string, error)

ParseServerAddress extracts the server part from a container image ref

func PullImage added in v0.4.2

func PullImage(ctx context.Context, imageName string, opts types.ImagePullOptions, handleOut func(io.ReadCloser)) error

func RemoveContainer added in v0.4.2

func RemoveContainer(ctx context.Context, id string) error

func RenameContainer added in v0.4.2

func RenameContainer(ctx context.Context, id string, name string) error

func StartContainer added in v0.4.2

func StartContainer(ctx context.Context, id string) error

func StopContainer added in v0.4.2

func StopContainer(ctx context.Context, id string) error

func TransformAuth added in v0.4.2

func TransformAuth(registryAuth string) string

TransformAuth from a base64 encoded json object to base64 encoded string

func WaitContainer added in v0.4.2

func WaitContainer(ctx context.Context, id string, condition container.WaitCondition) error

Types

type Manifests

type Manifests v1.Index

func RemoteManifest

func RemoteManifest(ctx context.Context, imageName string) (*Manifests, error)

type RegistryCredentials added in v0.4.2

type RegistryCredentials struct {
	Username string
	Password string // usually a token rather than an actual password
}

RegistryCredentials is a credential pair used for basic auth

type TokenResponse added in v0.4.2

type TokenResponse struct {
	Token string `json:"token"`
}

Jump to

Keyboard shortcuts

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