dockermgr

package module
v0.0.0-...-1be767d Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

README

Go

dockerManager

simgple docker manager api

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DockerClient

func DockerClient(apiVersion string) *client.Client

Types

type ClientAPI

type ClientAPI struct {
	DockerCli *client.Client
	Ctx       context.Context
}

func (*ClientAPI) ConnectNetwork

func (c *ClientAPI) ConnectNetwork(networkId string, containerId string) error

func (*ClientAPI) ContainerLogs

func (c *ClientAPI) ContainerLogs(writer http.ResponseWriter, containerId string, follow bool, since string, tail string, until string) error

func (*ClientAPI) Create

func (c *ClientAPI) Create(config *container.Config, hostConfig *container.HostConfig, networkConfig *network.NetworkingConfig, containerName string) (string, error)

func (*ClientAPI) CreateNetwork

func (c *ClientAPI) CreateNetwork(containerName string) (string, error)

func (*ClientAPI) EnsureImageExist

func (c *ClientAPI) EnsureImageExist(image string) (bool, error)

func (*ClientAPI) EnsureNetworkExist

func (c *ClientAPI) EnsureNetworkExist(networkName string) (string, error)

func (*ClientAPI) Exec

func (c *ClientAPI) Exec(containerId string, cmd []string) error

func (*ClientAPI) ExportImage

func (c *ClientAPI) ExportImage(imageId string) (io.ReadCloser, error)

func (*ClientAPI) FindContainer

func (c *ClientAPI) FindContainer(containerName string) (string, error)

func (*ClientAPI) ImageInfo

func (c *ClientAPI) ImageInfo(imageId string) (*types.ImageInspect, error)

func (*ClientAPI) ImportImage

func (c *ClientAPI) ImportImage(savePath string, repo string, tag string) error

func (*ClientAPI) Inspect

func (c *ClientAPI) Inspect(containerId string) (*types.ContainerJSON, error)

func (*ClientAPI) IsImageUsed

func (c *ClientAPI) IsImageUsed(imageID string) (bool, error)

func (*ClientAPI) PullImage

func (c *ClientAPI) PullImage(imageUrl string) error

func (*ClientAPI) RemoveContainer

func (c *ClientAPI) RemoveContainer(containerId string, removeVolumes bool) error

func (*ClientAPI) RemoveImage

func (c *ClientAPI) RemoveImage(imageId string, removeOpt types.ImageRemoveOptions) error

func (*ClientAPI) RemoveNetwork

func (c *ClientAPI) RemoveNetwork(networkId string) error

func (*ClientAPI) Restart

func (c *ClientAPI) Restart(containerId string, timeout int) error

func (*ClientAPI) Start

func (c *ClientAPI) Start(containerId string, startOpts types.ContainerStartOptions) error

func (*ClientAPI) Stats

func (c *ClientAPI) Stats(containerId string, stream bool) (*types.ContainerStats, error)

func (*ClientAPI) Status

func (c *ClientAPI) Status(containerId string) (*types.Container, error)

func (*ClientAPI) Stop

func (c *ClientAPI) Stop(containerId string, timeout int) error

type ClientAPIer

type ClientAPIer interface {
	Stop(containerId string, timeout int) error
	Restart(containerId string, timeout int) error
	PullImage(imageUrl string) error
	Create(config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (string, error)
	Start(containerId string, startOpts types.ContainerStartOptions) error
	EnsureImageExist(image string) (bool, error)
	CreateNetwork(containerName string) (string, error)
	ConnectNetwork(networkId string, containerId string) error
	RemoveImage(imageId string, removeOpt types.ImageRemoveOptions) error
	Status(containerId string) (*types.Container, error)
	Inspect(containerId string) (*types.ContainerJSON, error)
	Stats(containerId string, stream bool) (*types.ContainerStats, error)
	RemoveContainer(containerId string, removeVolumes bool) error
	RemoveNetwork(networkId string) error
	Exec(containerId string, cmd []string) error
	EnsureNetworkExist(networkName string) (string, error)
	FindContainer(containerName string) (string, error)
	IsImageUsed(imageID string) (bool, error)
	ContainerLogs(writer http.ResponseWriter, containerId string, follow bool, since string, tail string, until string) error
	ExportImage(imageId string) (io.ReadCloser, error)
	ImportImage(savePath string, repo string, tag string) error
	ImageInfo(imageId string) (*types.ImageInspect, error)
}

func GetContainerAPIer

func GetContainerAPIer() ClientAPIer

func NewContainerMgr

func NewContainerMgr(apiVersion string) ClientAPIer

Jump to

Keyboard shortcuts

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