docker

package
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: MIT Imports: 5 Imported by: 6

Documentation

Overview

Package docker is the API implementation on docker.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...NewOption) (api.Runtime, error)

New a docker runtime object.

Types

type Container added in v1.2.0

type Container struct {
	behaviour.Closer
	behaviour.FileSystem
	behaviour.Psutil
	behaviour.Container
	// contains filtered or unexported fields
}

func (*Container) Config added in v1.2.1

func (c *Container) Config() (*ContainerConfig, error)

func (*Container) Runtime added in v1.2.0

func (c *Container) Runtime() *Docker

type ContainerConfig added in v1.2.1

type ContainerConfig struct {
	State struct {
		Running           bool        `json:"Running"`
		Paused            bool        `json:"Paused"`
		Restarting        bool        `json:"Restarting"`
		OOMKilled         bool        `json:"OOMKilled"`
		RemovalInProgress bool        `json:"RemovalInProgress"`
		Dead              bool        `json:"Dead"`
		Pid               int         `json:"Pid"`
		ExitCode          int         `json:"ExitCode"`
		Error             string      `json:"Error"`
		StartedAt         time.Time   `json:"StartedAt"`
		FinishedAt        time.Time   `json:"FinishedAt"`
		Health            interface{} `json:"Health"`
	} `json:"State"`
	ID      string    `json:"ID"`
	Created time.Time `json:"Created"`
	Managed bool      `json:"Managed"`
	Path    string    `json:"Path"`
	Args    []string  `json:"Args"`
	Config  struct {
		Hostname     string              `json:"Hostname"`
		Domainname   string              `json:"Domainname"`
		User         string              `json:"User"`
		AttachStdin  bool                `json:"AttachStdin"`
		AttachStdout bool                `json:"AttachStdout"`
		AttachStderr bool                `json:"AttachStderr"`
		Tty          bool                `json:"Tty"`
		OpenStdin    bool                `json:"OpenStdin"`
		StdinOnce    bool                `json:"StdinOnce"`
		Env          []string            `json:"Env"`
		Cmd          []string            `json:"Cmd"`
		Image        string              `json:"Image"`
		Volumes      map[string]struct{} `json:"Volumes"`
		WorkingDir   string              `json:"WorkingDir"`
		Entrypoint   []string            `json:"Entrypoint"`
		OnBuild      []string            `json:"OnBuild"`
		Labels       map[string]string   `json:"Labels"`
	} `json:"Config"`
	Image           string `json:"Image"`
	NetworkSettings struct {
		Bridge                 string `json:"Bridge"`
		SandboxID              string `json:"SandboxID"`
		HairpinMode            bool   `json:"HairpinMode"`
		LinkLocalIPv6Address   string `json:"LinkLocalIPv6Address"`
		LinkLocalIPv6PrefixLen int    `json:"LinkLocalIPv6PrefixLen"`
		Networks               struct {
			Bridge struct {
				IPAMConfig          interface{} `json:"IPAMConfig"`
				Links               interface{} `json:"Links"`
				Aliases             interface{} `json:"Aliases"`
				NetworkID           string      `json:"NetworkID"`
				EndpointID          string      `json:"EndpointID"`
				Gateway             string      `json:"Gateway"`
				IPAddress           string      `json:"IPAddress"`
				IPPrefixLen         int         `json:"IPPrefixLen"`
				IPv6Gateway         string      `json:"IPv6Gateway"`
				GlobalIPv6Address   string      `json:"GlobalIPv6Address"`
				GlobalIPv6PrefixLen int         `json:"GlobalIPv6PrefixLen"`
				MacAddress          string      `json:"MacAddress"`
				DriverOpts          interface{} `json:"DriverOpts"`
				IPAMOperational     bool        `json:"IPAMOperational"`
			} `json:"bridge"`
		} `json:"Networks"`
		Service interface{} `json:"Service"`
		Ports   struct {
		} `json:"Ports"`
		SandboxKey             string      `json:"SandboxKey"`
		SecondaryIPAddresses   interface{} `json:"SecondaryIPAddresses"`
		SecondaryIPv6Addresses interface{} `json:"SecondaryIPv6Addresses"`
		IsAnonymousEndpoint    bool        `json:"IsAnonymousEndpoint"`
		HasSwarmEndpoint       bool        `json:"HasSwarmEndpoint"`
	} `json:"NetworkSettings"`
	LogPath                string `json:"LogPath"`
	Name                   string `json:"Name"`
	Driver                 string `json:"Driver"`
	Os                     string `json:"OS"`
	MountLabel             string `json:"MountLabel"`
	ProcessLabel           string `json:"ProcessLabel"`
	RestartCount           int    `json:"RestartCount"`
	HasBeenStartedBefore   bool   `json:"HasBeenStartedBefore"`
	HasBeenManuallyStopped bool   `json:"HasBeenManuallyStopped"`
	MountPoints            map[string]struct {
		Source      string `json:"Source"`
		Destination string `json:"Destination"`
		Rw          bool   `json:"RW"`
		Name        string `json:"Name"`
		Driver      string `json:"Driver"`
		Type        string `json:"Type"`
		Propagation string `json:"Propagation"`
		Spec        struct {
			Type   string `json:"Type"`
			Source string `json:"Source"`
			Target string `json:"Target"`
		} `json:"Spec"`
		SkipMountpointCreation bool `json:"SkipMountpointCreation"`
	} `json:"MountPoints"`
	SecretReferences  interface{} `json:"SecretReferences"`
	ConfigReferences  interface{} `json:"ConfigReferences"`
	AppArmorProfile   string      `json:"AppArmorProfile"`
	HostnamePath      string      `json:"HostnamePath"`
	HostsPath         string      `json:"HostsPath"`
	ShmPath           string      `json:"ShmPath"`
	ResolvConfPath    string      `json:"ResolvConfPath"`
	SeccompProfile    string      `json:"SeccompProfile"`
	NoNewPrivileges   bool        `json:"NoNewPrivileges"`
	LocalLogCacheMeta struct {
		HaveNotifyEnabled bool `json:"HaveNotifyEnabled"`
	} `json:"LocalLogCacheMeta"`
}

ContainerConfig reference for config.json in docker runtime

type Docker

type Docker struct {
	behaviour.Closer
	behaviour.Runtime
	behaviour.FileSystem
	// contains filtered or unexported fields
}

Docker is the connection established with a docker runtime.

func (*Docker) OpenContainerByID added in v1.2.0

func (d *Docker) OpenContainerByID(id string) (api.Container, error)

func (*Docker) OpenImageByID

func (d *Docker) OpenImageByID(id string) (api.Image, error)

func (*Docker) UniqueDesc added in v1.1.0

func (d *Docker) UniqueDesc() string

UniqueDesc represents the docker runtime's initialization arguments, which can be passed across process boundaries and initialize the same docker in another process.

type Image

type Image struct {
	behaviour.Closer
	behaviour.Image
	behaviour.FileSystem
	// contains filtered or unexported fields
}

Image represents a docker image, which is guaranteed to be the result of docker.Docker.OpenImageByID.

func (*Image) GetLayerDiffID

func (im *Image) GetLayerDiffID(i int) (string, error)

func (*Image) NumLayers

func (i *Image) NumLayers() int

func (*Image) OpenLayer

func (im *Image) OpenLayer(i int) (api.Layer, error)

func (*Image) Runtime

func (i *Image) Runtime() *Docker

type Layer

type Layer struct {
	behaviour.Closer
	behaviour.FileSystem
	// contains filtered or unexported fields
}

Layer represents a containerd layer, which is guaranteed to be the result of docker.Image.OpenLayer.

func (*Layer) ID

func (l *Layer) ID() string

func (*Layer) Image

func (l *Layer) Image() *Image

func (*Layer) Opaques added in v1.5.0

func (l *Layer) Opaques() ([]string, error)

func (*Layer) Whiteouts added in v1.5.0

func (l *Layer) Whiteouts() ([]string, error)

type NewOption added in v1.1.0

type NewOption func(*newArgs)

NewOption is the option that can be used for initializing an docker.Docker object.

func WithConfigPath added in v1.1.0

func WithConfigPath(path string) NewOption

WithConfigPath specifies the path of dockerd's config file.

Specifying this argument is semantically equivalent to specifying flag "--config-file" to dockerd, and its default search path is "/etc/docker/daemon.json".

Both dockerd and veinmind will render "/etc/docker/daemon.json" file as dispensible and fallback to use internal default config if unspecified. But once the argument is specified, it is no longer dispensible and error will be raised if the config is not found.

func WithDataRootDir added in v1.1.0

func WithDataRootDir(path string) NewOption

WithDataRootDir specifies the path of dockerd's data directory.

Specifying this argument is semantically equivalent to specifying flag "--data-root" to dockerd, and is default value is "/var/lib/docker".

func WithUniqueDesc added in v1.1.0

func WithUniqueDesc(desc string) NewOption

WithUniqueDesc specifies the unique descriptor of dockerd.

This argument must be result of docker.(*Docker).UniqueDesc() from another docker.Docker instance, potentially from another process. And the initialization might still fail if the API runtime context has not been set up properly.

Jump to

Keyboard shortcuts

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