Documentation ¶
Overview ¶
create docker api client
Index ¶
- func Containers2CMD(containersJSON []types.ContainerJSON, pretty bool) string
- func Containers2Compose(containersJSON []types.ContainerJSON) map[string]string
- func Containers2JSON(containers []types.ContainerJSON) string
- func ListPrint(containerSummary []types.Container, pretty bool)
- func ParseContainers(containersJSON []types.ContainerJSON, format string, pretty bool) interface{}
- type DockerClient
- func (d *DockerClient) ExportContainersJSON(dockerNameORID []string, showAll bool) ([]types.ContainerJSON, error)
- func (d *DockerClient) Find(containerNameOrID []string) (filteredContainers []types.Container, err error)
- func (d *DockerClient) FindImage(imageName string) (imagesSummary []image.Summary, err error)
- func (d *DockerClient) Inspect(containers []types.Container) (containersJSON []types.ContainerJSON, err error)
- func (d *DockerClient) InspectImageByID(imageID string) (imageJSON types.ImageInspect, err error)
- func (d *DockerClient) InspectImageByName(imageName string) (imageJSON types.ImageInspect, err error)
- func (d *DockerClient) List(showAll bool) ([]types.Container, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Containers2CMD ¶
func Containers2CMD(containersJSON []types.ContainerJSON, pretty bool) string
Containers2CMD 将容器详细信息打印为 docker run 格式
func Containers2Compose ¶
func Containers2Compose(containersJSON []types.ContainerJSON) map[string]string
Containers2Compose 将容器详细信息打印为 docker-compose 格式
func Containers2JSON ¶
func Containers2JSON(containers []types.ContainerJSON) string
Containers2JSON 将容器详细信息打印为 JSON 格式
func ParseContainers ¶
func ParseContainers(containersJSON []types.ContainerJSON, format string, pretty bool) interface{}
将容器信息格式化成指定格式
Types ¶
type DockerClient ¶
type DockerClient struct {
// contains filtered or unexported fields
}
DockerClient 结构体封装了 Docker 客户端及相关配置
func NewCli ¶
func NewCli(dockerHost, clientVersion string) (*DockerClient, error)
NewCli 创建新的 DockerClient 实例
func (*DockerClient) ExportContainersJSON ¶
func (d *DockerClient) ExportContainersJSON(dockerNameORID []string, showAll bool) ([]types.ContainerJSON, error)
Export 导出容器 json 格式详细信息
func (*DockerClient) Find ¶
func (d *DockerClient) Find(containerNameOrID []string) (filteredContainers []types.Container, err error)
Find 查找指定容器
func (*DockerClient) FindImage ¶
func (d *DockerClient) FindImage(imageName string) (imagesSummary []image.Summary, err error)
func (*DockerClient) Inspect ¶
func (d *DockerClient) Inspect(containers []types.Container) (containersJSON []types.ContainerJSON, err error)
Inspect 查看容器详细信息
func (*DockerClient) InspectImageByID ¶
func (d *DockerClient) InspectImageByID(imageID string) (imageJSON types.ImageInspect, err error)
func (*DockerClient) InspectImageByName ¶
func (d *DockerClient) InspectImageByName(imageName string) (imageJSON types.ImageInspect, err error)
Click to show internal directories.
Click to hide internal directories.