docker

package
v0.0.0-...-fa8172e Latest Latest
Warning

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

Go to latest
Published: May 10, 2018 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateContainer

func CreateContainer(param CreateContainerConf) (string, error)

创建容器

func DockerBuild

func DockerBuild(gitPath string, projectName string, tag string, recordId int64) error

创建docker镜像

func DockerPush

func DockerPush(projectName string, tag string) (string, error)

func DockerRun

func DockerRun()

func KillContainer

func KillContainer(host string, containerId string) error

杀死容器

func ListContainers

func ListContainers(host string) ([]types.Container, error)

显示容器列表

func ListImages

func ListImages(host string) ([]types.ImageSummary, error)

显示镜像列表

func PrintLogContainer

func PrintLogContainer(host string, containerID string) error

打印镜像日志

func PullImage

func PullImage(host string, imageName string) (string, error)

func RemoveContainer

func RemoveContainer(host string, containerID string, force bool, removeVolumes bool, removeLinks bool) error

移除容器

func StartContainer

func StartContainer(host string, containerId string) error

运行容器

func StopContainer

func StopContainer(host string, containerID string) error

停止容器

Types

type CreateContainerConf

type CreateContainerConf struct {
	Host        string //连接远程客户端的信息 eg:tcp://222.24.63.117:9000
	ServiceName string //服务名称,用作最后镜像名称
	Image       string //镜像名称
	//config所需参数
	WorkDir  string   //cmd执行的工作目录
	HostName string   //容器的hostname
	Env      []string //环境变量
	Cmd      []string //cmd内容
	//hostconfig所需参数
	HostList []string //host:ip的格式,存入host对应ip的解析
	Dns      []string //dns服务器ip地址
	Volume   []string //path:hostpath,容器内部目录和宿主机目录的挂载
	//config和hostconfig综合参数
	Expose []string //port:hostport,容器端口和宿主机端口的映射
}

创建镜像所使用的结构体

type LogJson

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

写入日志所用的json格式

type OutJson

type OutJson struct {
	Status string `json:"status"`
	Id     string `json:"id"`
}

获取pull 镜像时的json串格式

type RowJson

type RowJson struct {
	JsonStr OutJson
	Mess    string
}

每一行日志信息的格式

Jump to

Keyboard shortcuts

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