Documentation

Index

Constants

View Source
const (
	DigestStdLen = 64
	MB           = 1 << 20
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	Config   *v1.Config
	Digest   string
	RootFS   string
	Pids     []int
	Ports    []string
	Mounts   []string
	Hostname string
	Network  string
	IP       string
	// contains filtered or unexported fields
}

func GetAllContainers

func GetAllContainers() ([]*Container, error)

    GetAllContainers returns slice of running Containers.

    func GetContainerByDigest

    func GetContainerByDigest(digest string) (*Container, error)

      GetContainerByDigest returns a Container associate with a digest.

      func NewContainer

      func NewContainer() *Container

        / NewContainer returns a new Container with a random digest.

        func (*Container) GetIP

        func (c *Container) GetIP() (net.IP, network.Releaser, error)

        func (*Container) GetPids

        func (c *Container) GetPids() ([]int, error)

          GetPids returns slice of pid running inside Container.

          NOTE: First element [0], is the fork process.

          func (*Container) Kill

          func (c *Container) Kill() error

            Kill kills the Container.

            func (*Container) LoadCGroups

            func (c *Container) LoadCGroups() error

              LoadCGroups loads CGroups for container.

              func (*Container) LoadConfig

              func (c *Container) LoadConfig() error

                LoadConfig loads and sets Container Config from its image config file.

                func (*Container) MountFromImage

                func (c *Container) MountFromImage(img *image.Image) (filesystem.Unmounter, error)

                  MountFromImage mounts filesystem for Container from an Image. It uses overlayFS for union mount of multiple layers.

                  func (*Container) Remove

                  func (c *Container) Remove() error

                    Remove removes Container directory. It only works if all mount points have unmounted.

                    func (*Container) SetCPULimit

                    func (c *Container) SetCPULimit(cpus float64) *Container

                      SetCPULimit sets Container number of CPUs.

                      func (*Container) SetHostname

                      func (c *Container) SetHostname()

                        SetHostname sets Hostname for container.

                        If Hostname was empty it uses the digest[:12]

                        func (*Container) SetMemorySwapLimit

                        func (c *Container) SetMemorySwapLimit(memory, swap int) *Container

                          SetMemorySwapLimit sets Container's memory and swap limitation in MegaByte.

                          func (*Container) SetNetworkNamespace

                          func (c *Container) SetNetworkNamespace() (network.Unsetter, error)

                          func (*Container) SetPorts

                          func (c *Container) SetPorts(ports string)

                          func (*Container) SetProcessLimit

                          func (c *Container) SetProcessLimit(pids int) *Container

                            SetProcessLimit sets maximum simultaneous process for Container.

                            func (*Container) SetupNetwork

                            func (c *Container) SetupNetwork(bridge string) (filesystem.Unmounter, error)

                            func (*Container) SetupPortmap

                            func (c *Container) SetupPortmap() (nat.Unmapper, error)

                            func (*Container) Stop

                            func (c *Container) Stop() error

                              Stop stops the Container.