test

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PullAndRunAlpine

func PullAndRunAlpine(d *Dash) error

PullAndRunAlpine 拉取并运行 Alpine 容器

Types

type D

type D struct {
	Image   string          // 镜像名
	Ports   []string        // 映射端口
	ConName string          // 容器名
	ConID   string          // 容器id
	Client  *client.Client  // 连接
	Context context.Context // 上下文
}

D 包含 Docker 操作的方法

func NewDockerDash

func NewDockerDash(image string, opts ...client.Opt) (*D, error)

func (*D) Create

func (dash *D) Create(command []string) (string, error)

func (*D) Delete

func (dash *D) Delete() (err error)

func (*D) Start

func (dash *D) Start() (err error)

func (*D) Stop

func (dash *D) Stop() (err error)

type Dash

type Dash struct {
	Command      []string // 命令
	DockerDasher *D       // 操作
}

func (*Dash) HasImage

func (d *Dash) HasImage() (bool, error)

func (*Dash) MonitorContainerLogs

func (d *Dash) MonitorContainerLogs()

monitorContainerLogs 监控容器日志

func (*Dash) PullImage

func (d *Dash) PullImage(imgName string) error

type Dasher

type Dasher interface {
	Start() (err error)
	Stop() (err error)
	Delete() (err error)
	Create(command []string) (string, error)
}

Jump to

Keyboard shortcuts

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