dockerutil

package
v2.12.5 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
    https://gcr.io  _json_key
  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