dockerutil

package
v2.11.26 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func DescribeConfig

func DescribeConfig(w io.Writer, cfg *configfile.ConfigFile)

DescribeConfig creates a function that can write information about a configuration file.

Example (CredHelpers)
cfg, err := ReadConfig(filepath.Join("testdata", "credhelpers"))
if err != nil {
	panic(err)
}

DescribeConfig(os.Stdout, cfg)
Output:

Docker config:
  Auth:
    <none>
  Credential helpers:
    Registry     Helper
    asia.gcr.io  gcloud
    eu.gcr.io    gcloud
    gcr.io       gcloud
    us.gcr.io    gcloud
Example (CustomAuth)
cfg, err := ReadConfig(filepath.Join("testdata", "customauth"))
if err != nil {
	panic(err)
}

DescribeConfig(os.Stdout, cfg)
Output:

Docker config:
  Auth:
    Registry        Username   Email
    https://gcr.io  _json_key  not@val.id
  Credential helpers:
    <none>

func DescribeDefaultConfig

func DescribeDefaultConfig(w io.Writer)

DescribeDefaultConfig writes debug info about the default docker configuration to the given writer.

func DescribeWorkloadIdentity

func DescribeWorkloadIdentity(w io.Writer)

DescribeWorkloadIdentity writes debug info about the identity that can be accessed via the GCE Metadata server.

If the server can't be reached, a message gets printed that the server couldn't be found.

func GetAuthKeyChain

func GetAuthKeyChain() remote.Option

GetAuthKeyChain constructs the default auth key chain to authenticate with GCP services, e.g. GCR.

func ReadConfig

func ReadConfig(configPath string) (*configfile.ConfigFile, error)

ReadConfig is a utility function to read a docker config from a path. if the path is blank the default config is used.

Example
cfg, err := ReadConfig(filepath.Join("testdata", "credhelpers"))
if err != nil {
	panic(err)
}

fmt.Println(cfg.CredentialHelpers)
Output:

map[asia.gcr.io:gcloud eu.gcr.io:gcloud gcr.io:gcloud us.gcr.io:gcloud]

Types

This section is empty.

Jump to

Keyboard shortcuts

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