docker

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package docker 提供测试期间启动与停止 docker 容器的能力。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpContainerLogs

func DumpContainerLogs(id string) []byte

DumpContainerLogs 输出运行中容器的日志,用于测试失败时排查

func StopContainer

func StopContainer(id string) error

StopContainer 停止并删除指定容器(含挂载卷)

Types

type Container

type Container struct {
	Name     string
	HostPort string
}

Container 记录测试用容器的名字与宿主机访问地址

func StartContainer

func StartContainer(image string, name string, port string, dockerArgs []string, appArgs []string) (Container, error)

StartContainer 启动指定容器供测试使用。 每个测试可能运行在独立进程中,进程间无法串行化此调用, 故先查固定名容器是否已存在;启动失败时退避等待其他进程把容器拉起来。

Jump to

Keyboard shortcuts

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