docker

package
v0.4.10-alpha1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: Apache-2.0 Imports: 32 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

View Source
var Cache *cache.Cache

Functions

func BuildManifestURL

func BuildManifestURL(imageName string) (string, error)

BuildManifestURL from raw image data

func CloneContainer

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

func CompareDigest

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

CompareDigest ...

func Container

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

func ConvertToHostname

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

ConvertToHostname strips a url from everything but the hostname part

func CredentialsStore

func CredentialsStore(configFile configfile.ConfigFile) credentials.Store

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

func CurrentArchitecture

func CurrentArchitecture() (string, error)

func EncodeAuth

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

EncodeAuth Base64 encode an AuthConfig struct for transmission over HTTP

func EncodedAuth

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

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

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

func ExtractImageAndTag(imageName string) (string, string)

ExtractImageAndTag from a concatenated string

func GetArchitectures

func GetArchitectures(imageName string, noCache bool) ([]string, error)

func GetAuthURL

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

GetAuthURL from the instructions in the challenge

func GetBearerHeader

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

func GetChallenge(imageName string) (string, error)

GetChallenge fetches a challenge for the registry hosting the provided image

func GetChallengeRequest

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

GetChallengeRequest creates a request for getting challenge instructions

func GetChallengeURL

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

GetChallengeURL creates a URL object based on the image info

func GetDigest

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 GetManifest

func GetManifest(ctx context.Context, imageName string) (interface{}, string, error)

func GetPullOptions

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

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

func GetScopeFromImageName

func GetScopeFromImageName(img, svc string) string

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

func GetToken

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

func HasNewImage

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

func Image

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

func ImageName

func ImageName(containerInfo *types.ContainerJSON) string

func IsDaemonRunning

func IsDaemonRunning() bool

func NormalizeRegistry

func NormalizeRegistry(registry string) (string, error)

NormalizeRegistry makes sure variations of DockerHubs registry

func ParseServerAddress

func ParseServerAddress(ref string) (string, error)

ParseServerAddress extracts the server part from a container image ref

func PullImage

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

func RemoveContainer

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

func RenameContainer

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

func StartContainer

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

func StopContainer

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

func TransformAuth

func TransformAuth(registryAuth string) string

TransformAuth from a base64 encoded json object to base64 encoded string

func WaitContainer

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

Types

type RegistryCredentials

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

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