configfile

package
v29.9.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 14 Imported by: ? modules, 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

Constants

View Source
const DockerEnvConfigKey = "DOCKER_AUTH_CONFIG"

DockerEnvConfigKey is an environment variable that contains a JSON encoded credential config. It only supports storing the credentials as a base64 encoded string in the format base64("username:pat").

Adding additional fields will produce a parsing error.

Example:

{
	"auths": {
		"example.test": {
			"auth": base64-encoded-username-pat
		}
	}
}

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigFile

type ConfigFile struct {
	AuthConfigs          map[string]types.AuthConfig  `json:"auths"`
	HTTPHeaders          map[string]string            `json:"HttpHeaders,omitempty"`
	PsFormat             string                       `json:"psFormat,omitempty"`
	ImagesFormat         string                       `json:"imagesFormat,omitempty"`
	NetworksFormat       string                       `json:"networksFormat,omitempty"`
	PluginsFormat        string                       `json:"pluginsFormat,omitempty"`
	VolumesFormat        string                       `json:"volumesFormat,omitempty"`
	StatsFormat          string                       `json:"statsFormat,omitempty"`
	DetachKeys           string                       `json:"detachKeys,omitempty"`
	CredentialsStore     string                       `json:"credsStore,omitempty"`
	CredentialHelpers    map[string]string            `json:"credHelpers,omitempty"`
	Filename             string                       `json:"-"` // Note: for internal use only
	ServiceInspectFormat string                       `json:"serviceInspectFormat,omitempty"`
	ServicesFormat       string                       `json:"servicesFormat,omitempty"`
	TasksFormat          string                       `json:"tasksFormat,omitempty"`
	SecretFormat         string                       `json:"secretFormat,omitempty"`
	ConfigFormat         string                       `json:"configFormat,omitempty"`
	NodesFormat          string                       `json:"nodesFormat,omitempty"`
	PruneFilters         []string                     `json:"pruneFilters,omitempty"`
	Proxies              map[string]ProxyConfig       `json:"proxies,omitempty"`
	CurrentContext       string                       `json:"currentContext,omitempty"`
	CLIPluginsExtraDirs  []string                     `json:"cliPluginsExtraDirs,omitempty"`
	Plugins              map[string]map[string]string `json:"plugins,omitempty"`
	Aliases              map[string]string            `json:"aliases,omitempty"`
	Features             map[string]string            `json:"features,omitempty"`
}

ConfigFile ~/.docker/config.json file info

func New

func New(fn string) *ConfigFile

New initializes an empty configuration file for the given filename 'fn'

func (*ConfigFile) ContainsAuth

func (c *ConfigFile) ContainsAuth() bool

ContainsAuth returns whether there is authentication configured in this file or not.

func (*ConfigFile) GetAllCredentials

func (c *ConfigFile) GetAllCredentials() (map[string]types.AuthConfig, error)

GetAllCredentials returns all of the credentials stored in all of the configured credential stores.

func (*ConfigFile) GetAuthConfig

func (c *ConfigFile) GetAuthConfig(registryHostname string) (types.AuthConfig, error)

GetAuthConfig for a repository from the credential store

func (*ConfigFile) GetAuthConfigs

func (c *ConfigFile) GetAuthConfigs() map[string]types.AuthConfig

GetAuthConfigs returns the mapping of repo to auth configuration

func (*ConfigFile) GetCredentialsStore

func (c *ConfigFile) GetCredentialsStore(registryHostname string) credentials.Store

GetCredentialsStore returns a new credentials store from the settings in the configuration file

func (*ConfigFile) GetFilename

func (c *ConfigFile) GetFilename() string

GetFilename returns the file name that this config file is based on.

func (*ConfigFile) LoadFromReader

func (c *ConfigFile) LoadFromReader(configData io.Reader) error

LoadFromReader reads the configuration data given and sets up the auth config information with given directory and populates the receiver object

func (*ConfigFile) ParseProxyConfig

func (c *ConfigFile) ParseProxyConfig(host string, runOpts map[string]*string) map[string]*string

ParseProxyConfig computes proxy configuration by retrieving the config for the provided host and then checking this against any environment variables provided to the container

func (*ConfigFile) PluginConfig

func (c *ConfigFile) PluginConfig(pluginname, option string) (string, bool)

PluginConfig retrieves the requested option for the given plugin.

func (*ConfigFile) Save

func (c *ConfigFile) Save() (retErr error)

Save encodes and writes out all the authorization information

func (*ConfigFile) SaveToWriter

func (c *ConfigFile) SaveToWriter(writer io.Writer) error

SaveToWriter encodes and writes out all the authorization information to the given writer

func (*ConfigFile) SetPluginConfig

func (c *ConfigFile) SetPluginConfig(pluginname, option, value string)

SetPluginConfig sets the option to the given value for the given plugin. Passing a value of "" will remove the option. If removing the final config item for a given plugin then also cleans up the overall plugin entry.

type ProxyConfig

type ProxyConfig struct {
	HTTPProxy  string `json:"httpProxy,omitempty"`
	HTTPSProxy string `json:"httpsProxy,omitempty"`
	NoProxy    string `json:"noProxy,omitempty"`
	FTPProxy   string `json:"ftpProxy,omitempty"`
	AllProxy   string `json:"allProxy,omitempty"`
}

ProxyConfig contains proxy configuration settings

Jump to

Keyboard shortcuts

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