Documentation ¶
Overview ¶
Package container tracks the current containers from the docker runtime.
Index ¶
- Constants
- func CreateGet(cfg Config) query.GetFunc
- func IsDockerRunning() bool
- func IsErrDockerClientVersionNewerThanDaemon(err error) bool
- func ListContainers(ctx context.Context) ([]docker_types.Container, error)
- func New(ctx context.Context, cfg Config) components.Component
- type Config
- type DockerContainer
- type Output
Constants ¶
View Source
const ( StateNameDockerContainer = "docker_container" StateKeyDockerContainerData = "data" StateKeyDockerContainerEncoding = "encoding" StateValueDockerContainerEncodingJSON = "json" PodNameLabel = "io.kubernetes.pod.name" PodNamespaceLabel = "io.kubernetes.pod.namespace" )
View Source
const Name = "docker-container"
Variables ¶
This section is empty.
Functions ¶
func IsDockerRunning ¶
func IsDockerRunning() bool
If not run, fails with: "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"
func IsErrDockerClientVersionNewerThanDaemon ¶
IsErrDockerClientVersionNewerThanDaemon returns true if the docker client version is newer than the daemon version. e.g., "Error response from daemon: client version 1.44 is too new. Maximum supported API version is 1.43"
func ListContainers ¶
func ListContainers(ctx context.Context) ([]docker_types.Container, error)
If not run, fails with: "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"
Types ¶
type Config ¶
type Config struct { Query query_config.Config `json:"query"` // In case the docker daemon is not running, we ignore such errors as // 'Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?'. IgnoreConnectionErrors bool `json:"ignore_connection_errors"` }
type DockerContainer ¶
type DockerContainer struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Image string `json:"image,omitempty"` CreatedAt int64 `json:"created_at,omitempty"` State string `json:"state,omitempty"` PodName string `json:"pod_name,omitempty"` PodNamespace string `json:"pod_namespace,omitempty"` }
func ConvertToDockerContainer ¶
func ConvertToDockerContainer(resp docker_types.Container) DockerContainer
func ParseStateDockerContainer ¶
func ParseStateDockerContainer(m map[string]string) ([]DockerContainer, error)
func (DockerContainer) JSON ¶
func (s DockerContainer) JSON() ([]byte, error)
type Output ¶
type Output struct { Containers []DockerContainer `json:"containers,omitempty"` // Sets true if the docker client calls due to the version incompatibility issue. // e.g., // "Error response from daemon: client version 1.44 is too new. Maximum supported API version is 1.43" IsErrDockerClientVersionNewerThanDaemon bool `json:"is_err_docker_client_version_newer_than_daemon,omitempty"` DockerClientError string `json:"docker_client_error,omitempty"` DockerPidFound bool `json:"docker_pid_found,omitempty"` // In case the docker daemon is not running // 'Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?'. ConnectionError string `json:"connection_error,omitempty"` Message string `json:"message,omitempty"` }
func ParseOutputJSON ¶
func ParseStatesToOutput ¶
func ParseStatesToOutput(states ...components.State) (*Output, error)
Click to show internal directories.
Click to hide internal directories.