dockerUtils

package module
v0.0.0-...-a33b350 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainerIsDocker

func ContainerIsDocker(id, rootfs string) (bool, error)

ContainerIsDocker returns true if the given container ID corresponds to a Docker container. It does this by first trying to query Docker for the container. If this doesn't work, it uses a heuristic based on the container's rootfs.

Types

type ContainerInfo

type ContainerInfo struct {
	Rootfs     string
	AutoRemove bool
}

type Docker

type Docker struct {
	// contains filtered or unexported fields
}

func DockerConnect

func DockerConnect(timeout time.Duration) (*Docker, error)

DockerConnect establishes a session with the Docker daemon.

func (*Docker) ContainerGetImageID

func (d *Docker) ContainerGetImageID(containerID string) (string, error)

ContainerGetImageID returns the image ID of the given container; may be called during container creation.

func (*Docker) ContainerGetInfo

func (d *Docker) ContainerGetInfo(containerID string) (*ContainerInfo, error)

ContainerGetInfo returns info for the given container. Must be called after the container is created.

func (*Docker) Disconnect

func (d *Docker) Disconnect() error

func (*Docker) GetDataRoot

func (d *Docker) GetDataRoot() string

GetDataRoot returns the Docker daemon's data-root dir (usually "/var/lib/docker/").

type DockerErr

type DockerErr struct {
	Code ErrCode
	// contains filtered or unexported fields
}

func (*DockerErr) Error

func (e *DockerErr) Error() string

type ErrCode

type ErrCode int
const (
	DockerConnErr ErrCode = iota
	DockerDiscErr
	DockerInfoErr
	DockerContInfoErr
	DockerOtherErr
)

Jump to

Keyboard shortcuts

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