Documentation ¶ Index ¶ func PullAndRunAlpine(d *Dash) error type D func NewDockerDash(image string, opts ...client.Opt) (*D, error) func (dash *D) Create(command []string) (string, error) func (dash *D) Delete() (err error) func (dash *D) Start() (err error) func (dash *D) Stop() (err error) type Dash type Dasher 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 // 操作 } type Dasher ¶ type Dasher interface { Start() (err error) Stop() (err error) Delete() (err error) Create(command []string) (string, error) } Source Files ¶ View all Source files client.go curd.go docker.go tool.go Click to show internal directories. Click to hide internal directories.