dockerclient

package
v0.0.0-...-f1c52c0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvDockerConfig    = "DOCKER_CONFIG"
	EnvDockerContext   = "DOCKER_CONTEXT"
	EnvDockerAPIVer    = "DOCKER_API_VERSION"
	EnvDockerHost      = "DOCKER_HOST"
	EnvDockerTLSVerify = "DOCKER_TLS_VERIFY"
	EnvDockerCertPath  = "DOCKER_CERT_PATH"
	UnixSocketPath     = "/var/run/docker.sock"
	UnixSocketAddr     = "unix:///var/run/docker.sock"
)
View Source
const (
	DefaultContextName   = "default" //does not have a context file (pseudo-context)
	DockerConfigFileName = "config.json"
	DockerMetaFileName   = "meta.json"
	DockerEndpointType   = "docker"
)

Variables

View Source
var (
	ErrNoDockerInfo = errors.New("no docker info")
)

Functions

func ConfigFileDir

func ConfigFileDir() string

func ConfigFilePath

func ConfigFilePath() string

func ContextsDir

func ContextsDir() string

func ContextsMetaDir

func ContextsMetaDir() string

func ContextsTLSDir

func ContextsTLSDir() string

func HasSocket

func HasSocket(name string) bool

func HasSystemDockerSocket

func HasSystemDockerSocket() bool

func HasUserDockerSocket

func HasUserDockerSocket() bool

func New

func New(config *config.DockerClient) (*docker.Client, error)

New creates a new Docker client instance

func UserDockerSocket

func UserDockerSocket() string

func UserHomeDir

func UserHomeDir() string

Types

type AuthConfig

type AuthConfig struct {
	Username      string `json:"username,omitempty"`
	Password      string `json:"password,omitempty"`
	Auth          string `json:"auth,omitempty"`
	IdentityToken string `json:"identitytoken,omitempty"` //to auth user and get access token from registry
	RegistryToken string `json:"registrytoken,omitempty"` //bearer token for registry
	ServerAddress string `json:"serveraddress,omitempty"`
	Email         string `json:"email,omitempty"` //depricated field
}

type DockerConfigFile

type DockerConfigFile struct {
	CurrentContext    string                 `json:"currentContext,omitempty"`
	CredentialsStore  string                 `json:"credsStore,omitempty"`
	CredentialHelpers map[string]string      `json:"credHelpers,omitempty"`
	AuthConfigs       map[string]AuthConfig  `json:"auths"`
	Proxies           map[string]ProxyConfig `json:"proxies,omitempty"`
}

only relevant fields...

func ReadConfigFile

func ReadConfigFile(filePath string) (*DockerConfigFile, error)

type DockerContextMetadata

type DockerContextMetadata struct {
	Name     string
	Metadata struct {
		Description string
	}
	Endpoints map[string]EndpointMetadata
}

func ListContextsMetadata

func ListContextsMetadata(dirPath string) ([]*DockerContextMetadata, error)

func ReadContextMetadataFile

func ReadContextMetadataFile(filePath string) (*DockerContextMetadata, error)

func (*DockerContextMetadata) Endpoint

func (ref *DockerContextMetadata) Endpoint() *EndpointMetadata

type EndpointMetadata

type EndpointMetadata struct {
	Host          string
	SkipTLSVerify bool
}

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

type SocketInfo

type SocketInfo struct {
	Address       string `json:"address"`
	FilePath      string `json:"file_path"`
	FileType      string `json:"type"`
	FilePerms     string `json:"perms"`
	SymlinkTarget string `json:"symlink_target,omitempty"`
	TargetPerms   string `json:"target_perms,omitempty"`
	TargetType    string `json:"target_type,omitempty"`
	CanRead       bool   `json:"can_read"`
	CanWrite      bool   `json:"can_write"`
}

func GetUnixSocketAddr

func GetUnixSocketAddr() (*SocketInfo, error)

Jump to

Keyboard shortcuts

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