dockercli

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

create docker api client

Index

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 ListPrint

func ListPrint(containerSummary []types.Container, pretty bool)

listPrint 打印每个容器的信息

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)

func (*DockerClient) List

func (d *DockerClient) List(showAll bool) ([]types.Container, error)

List 列出所有 Docker 容器

Jump to

Keyboard shortcuts

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