driver

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RUNNING             string = "running"
	STOP                string = "stopped"
	EXIT                string = "exited"
	DefaultInfoLocation string = "/var/lib/gocker/%s/"
	ConfigName          string = "config.json"
	ContainerLogFile    string = "container.log"
	Dirver              string = "overlay"
	OverlayDir          string = "/var/lib/gocker/overlay/"
)
View Source
const (
	DriverURL = "/var/lib/gocker/overlay/"
)

Variables

Functions

func CreateReadOnlyLayer

func CreateReadOnlyLayer(imageName, layerName string) error

创建只读的lower层 复制一份可执行文件过来 TODO: 支持java等的语言

func CreateWriteLayer

func CreateWriteLayer(layerName string) error

创建并挂载 work,upper,merged

func DeleteMountPoint

func DeleteMountPoint(overlayDir string) error

func DeleteVolumes

func DeleteVolumes(volumeURLs []string, layName string) error

func DeleteWorkSpace

func DeleteWorkSpace(volueme, layerName string)

删除容器overlay filesystem(仅保留lower层

func DeleteWriteLayer

func DeleteWriteLayer(layerName string)

从磁盘上删除overlay层 一定要先unmount后才进行删除!!!

func InitLog

func InitLog(sugar *zap.SugaredLogger)

func NewParentProcess

func NewParentProcess(tty bool, containerName, volume, imageName string, envSlice []string) (*exec.Cmd, *os.File)

func NewPipe

func NewPipe() (*os.File, *os.File, error)

func NewWorkSpace

func NewWorkSpace(volume, imageName, layerName string)

创建一个overlay2的文件系统

func PathExists

func PathExists(path string) (bool, error)

判断文件/文件夹是否存在

func RunContainerInitProcess

func RunContainerInitProcess() error

这里的init函数是在容器内部执行的,进到这步的时候容器已经创建出来了 使用 mount 去挂载 proc 文件系统

Types

type ContainerInfo

type ContainerInfo struct {
	Pid         string   `json:"pid"`         //容器的init进程在宿主机上的 PID
	Id          string   `json:"id"`          //容器Id
	Name        string   `json:"name"`        //容器名
	Command     string   `json:"command"`     //容器内init运行命令
	CreatedTime string   `json:"createTime"`  //创建时间
	Status      string   `json:"status"`      //容器的状态
	Volume      string   `json:"volume"`      //容器的数据卷
	PortMapping []string `json:"portmapping"` //端口映射
}

Jump to

Keyboard shortcuts

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