Documentation ¶
Index ¶
- Variables
- type APIContainers
- type APIImages
- type APIMount
- type APIPort
- type Client
- func (c *Client) InspectService(id string) (*swarm.Service, error)
- func (c *Client) ListContainers() ([]APIContainers, error)
- func (c *Client) ListImages() ([]APIImages, error)
- func (c *Client) ListServices() ([]swarm.Service, error)
- func (c *Client) RemoveContainer(opts RemoveContainerOptions) error
- func (c *Client) RemoveImage(name string) error
- func (c *Client) StopContainer(id string) error
- func (c *Client) UpdateService(id string, opts UpdateServiceOptions) error
- type ContainerNetwork
- type ContainerNotFound
- type ContainerNotRunning
- type Dialer
- type Error
- type NetworkList
- type NoSuchService
- type RemoveContainerOptions
- type UpdateServiceOptions
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidEndpoint is returned when the endpoint is not a valid URL. ErrInvalidEndpoint = errors.New("invalid endpoint") // ErrConnectionRefused is returned when the client cannot connect to the given endpoint. ErrConnectionRefused = errors.New("cannot connect to Docker endpoint") )
var ErrNoSuchImage = errors.New("no such image")
ErrNoSuchImage is error returned when the image does not exist.
Functions ¶
This section is empty.
Types ¶
type APIContainers ¶ added in v0.3.23
type APIContainers struct { ID string `json:"Id"` Image string `json:"Image,omitempty"` State string `json:"State,omitempty"` Status string `json:"Status,omitempty"` Command string `json:"Command,omitempty"` SizeRw int64 `json:"SizeRw,omitempty"` SizeRootFs int64 `json:"SizeRootFs,omitempty"` Names []string `json:"Names,omitempty"` Ports []APIPort `json:"Ports,omitempty"` Mounts []APIMount `json:"Mounts,omitempty"` Labels map[string]string `json:"Labels,omitempty"` Networks NetworkList `json:"NetworkSettings,omitempty"` }
APIContainers Docker API ListContainers 响应体切片中的容器实体
type APIImages ¶ added in v0.3.20
type APIImages struct { ID string `json:"Id"` RepoTags []string `json:"RepoTags,omitempty"` Created int64 `json:"Created,omitempty"` Size int64 `json:"Size,omitempty"` VirtualSize int64 `json:"VirtualSize,omitempty"` ParentID string `json:"ParentId,omitempty"` RepoDigests []string `json:"RepoDigests,omitempty"` Labels map[string]string `json:"Labels,omitempty"` }
APIImages represent an image returned to the ListImages call.
type APIMount ¶ added in v0.3.23
type APIMount struct { Name string `json:"Name,omitempty"` Mode string `json:"Mode,omitempty"` Source string `json:"Source,omitempty"` Driver string `json:"Driver,omitempty"` Destination string `json:"Destination,omitempty"` Propagation string `json:"Propagation,omitempty"` }
APIMount 容器的挂载点
type APIPort ¶ added in v0.3.23
type APIPort struct { Type string `json:"Type,omitempty"` PublicPort int64 `json:"publicPort,omitempty"` PrivatePort int64 `json:"privatePort,omitempty"` }
APIPort Docker API 返回的端口映射类型
type Client ¶ added in v0.3.16
type Client struct { Dialer Dialer TLSConfig *tls.Config HTTPClient *http.Client // contains filtered or unexported fields }
func NewTLSClient ¶
NewTLSClient returns a Client instance ready for TLS communications with the givens server endpoint, key and certificates, using a specific remote API version. TODO: 🚧 Under construction...
func (*Client) InspectService ¶ added in v0.3.27
InspectService returns information about a service by its ID.
More: https://docs.docker.com/engine/api/v1.41/#tag/Service/operation/ServiceInspect
func (*Client) ListContainers ¶ added in v0.3.23
func (c *Client) ListContainers() ([]APIContainers, error)
ListContainers 返回容器切片
More: https://docs.docker.com/engine/api/v1.41/#tag/Container
func (*Client) ListImages ¶ added in v0.3.20
ListImages returns the list of available images in the server.
func (*Client) ListServices ¶ added in v0.3.18
ListServices returns a slices of services
More: https://docs.docker.com/engine/api/v1.41/#tag/Service/operation/ServiceList
func (*Client) RemoveContainer ¶ added in v0.3.25
func (c *Client) RemoveContainer(opts RemoveContainerOptions) error
RemoveContainer 删除容器
More: https://docs.docker.com/engine/api/v1.25/#tag/Container/operation/ContainerDelete
func (*Client) RemoveImage ¶ added in v0.3.20
RemoveImage remove an image by its name or ID.
More: https://docs.docker.com/engine/api/v1.41/#tag/Image/operation/ImageDelete.
func (*Client) StopContainer ¶ added in v0.3.25
StopContainer 停止容器
func (*Client) UpdateService ¶ added in v0.3.27
func (c *Client) UpdateService(id string, opts UpdateServiceOptions) error
type ContainerNetwork ¶ added in v0.3.23
type ContainerNetwork struct { Aliases []string `json:"Aliases,omitempty"` IPPrefixLen int `json:"IPPrefixLen,omitempty"` GlobalIPv6PrefixLen int `json:"GlobalIPv6PrefixLen,omitempty"` Gateway string `json:"Gateway,omitempty"` NetworkID string `json:"NetworkID,omitempty"` IPAddress string `json:"IPAddress,omitempty"` EndpointID string `json:"EndpointID,omitempty"` MacAddress string `json:"MacAddress,omitempty"` IPv6Gateway string `json:"IPv6Gateway,omitempty"` GlobalIPv6Address string `json:"GlobalIPv6Address,omitempty"` }
ContainerNetwork 容器的网络
type ContainerNotFound ¶ added in v0.3.25
ContainerNotFound 容器没找到
func (*ContainerNotFound) Error ¶ added in v0.3.25
func (err *ContainerNotFound) Error() string
type ContainerNotRunning ¶ added in v0.3.25
type ContainerNotRunning struct {
ID string
}
ContainerNotRunning 容器未运行
func (*ContainerNotRunning) Error ¶ added in v0.3.25
func (err *ContainerNotRunning) Error() string
type NetworkList ¶ added in v0.3.23
type NetworkList struct {
Networks map[string]ContainerNetwork `json:"Networks,omitempty"`
}
NetworkList 容器的网络映射
type NoSuchService ¶ added in v0.3.27
func (*NoSuchService) Error ¶ added in v0.3.27
func (err *NoSuchService) Error() string
type RemoveContainerOptions ¶ added in v0.3.25
type RemoveContainerOptions struct { // 容器ID ID string }
RemoveContainerOptions 封装用于删除容器的选项
type UpdateServiceOptions ¶ added in v0.3.27
type UpdateServiceOptions struct { Version uint64 swarm.ServiceSpec }