container

package
v0.0.0-...-07e86f5 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Running string = "running"
	Stop    string = "stopped"
	Exit    string = "exited"
)

Variables

This section is empty.

Functions

func DelImageByName

func DelImageByName(names []string) error

func Exce

func Exce(name string, cmdArr []string, tty bool) error

func ExportCommitContainer

func ExportCommitContainer(name string, imgetar string) error

func GetConfigSavePath

func GetConfigSavePath() string

func GetInfoByContainerName

func GetInfoByContainerName(containerName string, data *ContainerInfos) error

func GetLogByContainerName

func GetLogByContainerName(containerName string) (string, error)

func LoadImage

func LoadImage(image string) error

func NewWorkSpace

func NewWorkSpace(baseImgName string, containerName string, volumeArg []string) (*workSpace, error)

初始化工作区 并挂载overlay root 镜像的根目录 baseImg 镜像名称 mnt overlay挂载点

func RestartContainer

func RestartContainer(name string) error

func Rm

func Rm(name string, force bool) error

func RunContainer

func RunContainer(args *RunCommandArgs) error

func RunContainerProgram

func RunContainerProgram() error

func StartContainerByName

func StartContainerByName(name string) error

func StopContainerByName

func StopContainerByName(name string) error

func WirteImagesInfoToTabwriter

func WirteImagesInfoToTabwriter(w *tabwriter.Writer) error

Types

type ContainerInfos

type ContainerInfos struct {
	Id          string                `json:"id"`         //容器id
	Pid         string                `json:"pid"`        //容器init进程在宿主机上的pid
	Name        string                `json:"name"`       //容器名称
	Command     string                `json:"command"`    //容器init进程执行的命令
	CreateTime  string                `json:"createTime"` //容器创建时间
	Status      string                `json:"status"`     //容器状态
	Volume      []string              `json:"volume"`
	PortMapping []string              `json:"portMapping"`
	IpInfo      network.Endpoint      `json:"ipInfo"`
	Env         []string              `json:"env"`
	Cg          cgroups.CgroupManager `json:"cg"`
	WorkSpace   workSpace             `json:"wrokSpace"`
}

func (*ContainerInfos) DeleteContainerInfo

func (t *ContainerInfos) DeleteContainerInfo()

func (*ContainerInfos) RecordContainerInfo

func (t *ContainerInfos) RecordContainerInfo() error

func (*ContainerInfos) SetCg

func (t *ContainerInfos) SetCg(cg *cgroups.CgroupManager)

func (*ContainerInfos) SetContainerName

func (t *ContainerInfos) SetContainerName(containerName string)

func (*ContainerInfos) SetNetInfo

func (t *ContainerInfos) SetNetInfo(ep *network.Endpoint)

func (*ContainerInfos) SetWorkSpace

func (t *ContainerInfos) SetWorkSpace(ws *workSpace)

func (*ContainerInfos) UpdatePid

func (t *ContainerInfos) UpdatePid(pid int)

func (*ContainerInfos) WirteInfoToTabwriter

func (t *ContainerInfos) WirteInfoToTabwriter(w *tabwriter.Writer)

type RunCommandArgs

type RunCommandArgs struct {
	Tty           bool
	VolumeArg     []string
	LimitResConf  *limit.ResourceConfig
	CommandArgs   []string
	Detach        bool
	ContainerName string
	ImageName     string
	EnvList       []string
	Net           string
	PortMapping   string
}

Jump to

Keyboard shortcuts

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