Documentation ¶
Index ¶
- type ContainerDef
- type DockerOp
- type OpClient
- func (c *OpClient) Close() error
- func (c *OpClient) ContainerCreate(ctx context.Context, def *ContainerDef) (string, error)
- func (c *OpClient) ContainerExec(ctx context.Context, containerID string, cmd []string) (string, error)
- func (c *OpClient) ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
- func (c *OpClient) ContainerList(ctx context.Context) ([]types.Container, error)
- func (c *OpClient) ContainerLogs(ctx context.Context, containerID string) (string, error)
- func (c *OpClient) ContainerPause(ctx context.Context, containerID string) error
- func (c *OpClient) ContainerRemove(ctx context.Context, containerID string) error
- func (c *OpClient) ContainerStart(ctx context.Context, containerID string) error
- func (c *OpClient) ContainerStop(ctx context.Context, containerID string, timeout *time.Duration) error
- func (c *OpClient) ImageList(ctx context.Context) ([]types.ImageSummary, error)
- func (c *OpClient) ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (string, error)
- func (c *OpClient) ImageRemove(ctx context.Context, imageID string) error
- func (c *OpClient) ImagesPrune(ctx context.Context) error
- func (c *OpClient) Info(ctx context.Context) (types.Info, error)
- func (c *OpClient) Ping(ctx context.Context) (types.Ping, error)
- func (c *OpClient) RegistryLogin(ctx context.Context, auth types.AuthConfig) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContainerDef ¶
type DockerOp ¶
type DockerOp interface { // client basic function: // NewOpClient create a new client of docker engine Close() error // close Ping(ctx context.Context) (types.Ping, error) Info(ctx context.Context) (types.Info, error) RegistryLogin(ctx context.Context, auth types.AuthConfig) error // client image function: ImageList(ctx context.Context) ([]types.ImageSummary, error) ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (string, error) ImageRemove(ctx context.Context, imageID string) error ImagesPrune(ctx context.Context) error // client container function: ContainerList(ctx context.Context) ([]types.Container, error) ContainerCreate(ctx context.Context, def *ContainerDef) (string, error) ContainerStart(ctx context.Context, containerID string) error ContainerPause(ctx context.Context, containerID string) error ContainerStop(ctx context.Context, containerID string, timeout *time.Duration) error ContainerRemove(ctx context.Context, containerID string) error ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error) ContainerLogs(ctx context.Context, containerID string) (string, error) ContainerExec(ctx context.Context, containerID string, cmd []string) (string, error) }
DockerOp interface of dockerop
type OpClient ¶
type OpClient struct { // others Auth types.AuthConfig Time time.Time // set in RegistryLogin IdentityToken string // returned in RegistryLogin Status string // returned in RegistryLogin // contains filtered or unexported fields }
OpClient the client operating docker engine
func NewOpClient ¶
NewOpClient return a pointer to OpClient
func (*OpClient) ContainerCreate ¶
ContainerCreate create a container
func (*OpClient) ContainerExec ¶
func (c *OpClient) ContainerExec(ctx context.Context, containerID string, cmd []string) (string, error)
ContainerExec exec cmds in remote docker and return stdout/stderr cmd such as : []string{"ls", "-al"},
func (*OpClient) ContainerInspect ¶
func (c *OpClient) ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
ContainerInspect pause the container
func (*OpClient) ContainerList ¶
ContainerList return all of the containers
func (*OpClient) ContainerLogs ¶
ContainerLogs return the logs in container
func (*OpClient) ContainerPause ¶
ContainerPause pause the container
func (*OpClient) ContainerRemove ¶
ContainerRemove remove the container
func (*OpClient) ContainerStart ¶
ContainerStart start the container
func (*OpClient) ContainerStop ¶
func (c *OpClient) ContainerStop(ctx context.Context, containerID string, timeout *time.Duration) error
ContainerStop stops a container. In case the container fails to stop gracefully within a time frame specified by the timeout argument, it is forcefully terminated (killed). If the timeout is nil, the container's StopTimeout value is used, if set, otherwise the engine default. A negative timeout value can be specified, meaning no timeout, i.e. no forceful termination is performed.
func (*OpClient) ImagePull ¶
func (c *OpClient) ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (string, error)
ImagePull pull the image, options has the cred of registry. ref such as "docker.io/library/nginx:latest" return `docker pull stdout information` and `error`
func (*OpClient) ImageRemove ¶
ImageRemove remove the image
func (*OpClient) ImagesPrune ¶
ImagesPrune prune the image
func (*OpClient) RegistryLogin ¶
RegistryLogin authenticates the docker server with a given docker registry.