...

Package configfile

import "github.com/docker/cli/cli/config/configfile"
Overview
Index

Overview ▾

type ConfigFile

ConfigFile ~/.docker/config.json file info

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"`
    Experimental         string                       `json:"experimental,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"`
}

func New

func New(fn string) *ConfigFile

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

func (*ConfigFile) ContainsAuth

func (configFile *ConfigFile) ContainsAuth() bool

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

func (*ConfigFile) GetAllCredentials

func (configFile *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 (configFile *ConfigFile) GetAuthConfig(registryHostname string) (types.AuthConfig, error)

GetAuthConfig for a repository from the credential store

func (*ConfigFile) GetAuthConfigs

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

GetAuthConfigs returns the mapping of repo to auth configuration

func (*ConfigFile) GetCredentialsStore

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

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

func (*ConfigFile) GetFilename

func (configFile *ConfigFile) GetFilename() string

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

func (*ConfigFile) LoadFromReader

func (configFile *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 (configFile *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 (configFile *ConfigFile) PluginConfig(pluginname, option string) (string, bool)

PluginConfig retrieves the requested option for the given plugin.

func (*ConfigFile) Save

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

Save encodes and writes out all the authorization information

func (*ConfigFile) SaveToWriter

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

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

func (*ConfigFile) SetPluginConfig

func (configFile *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

ProxyConfig contains proxy configuration settings

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"`
}