Documentation ¶
Index ¶
- Variables
- func ConnectToDockerOrDie()
- func IsContainerNotFoundError(err error) bool
- type ExecHandler
- type ExecTimeoutError
- type NativeExecHandler
- type RuntimeExecutor
- func (e *RuntimeExecutor) ContainerStatus(ctx context.Context, req *runtime.ContainerStatusRequest) (*runtime.ContainerStatusResponse, error)
- func (e *RuntimeExecutor) CreateContainer(ctx context.Context, r *runtime.CreateContainerRequest) (*runtime.CreateContainerResponse, error)
- func (e *RuntimeExecutor) ExecSync(ctx context.Context, r *runtime.ExecRequest) (*runtime.ExecResponse, error)
- func (e *RuntimeExecutor) ImageStatus(ctx context.Context, r *runtime.ImageStatusRequest) (*runtime.ImageStatusResponse, error)
- func (e *RuntimeExecutor) ListContainers(ctx context.Context, r *runtime.ListContainersRequest) (*runtime.ListContainersResponse, error)
- func (e *RuntimeExecutor) ListImages(ctx context.Context, r *runtime.ListImagesRequest) (*runtime.ListImagesResponse, error)
- func (e *RuntimeExecutor) PullImage(ctx context.Context, r *runtime.PullImageRequest) (*runtime.PullImageResponse, error)
- func (e *RuntimeExecutor) RemoveContainer(ctx context.Context, r *runtime.RemoveContainerRequest) error
- func (e *RuntimeExecutor) RemoveImage(ctx context.Context, r *runtime.RemoveImageRequest) error
- func (e *RuntimeExecutor) StartContainer(ctx context.Context, r *runtime.StartContainerRequest) error
- func (e *RuntimeExecutor) Status(ctx context.Context, r *runtime.StatusRequest) (*runtime.StatusResponse, error)
- func (e *RuntimeExecutor) StopContainer(ctx context.Context, r *runtime.StopContainerRequest) error
- func (e *RuntimeExecutor) Type() string
- func (e *RuntimeExecutor) Version(ctx context.Context, vr *runtime.VersionRequest) (*runtime.VersionResponse, error)
Constants ¶
This section is empty.
Variables ¶
var ( // DockerImageIDPrefix is the prefix of image id in container status. DockerImageIDPrefix = "docker://" // DockerPullableImageIDPrefix is the prefix of pullable image id in container status. DockerPullableImageIDPrefix = "docker-pullable://" )
Functions ¶
func ConnectToDockerOrDie ¶
func ConnectToDockerOrDie()
ConnectToDockerOrDie tries to connect to the docker and prints the version
func IsContainerNotFoundError ¶
IsContainerNotFoundError checks whether the error is container not found error.
Types ¶
type ExecHandler ¶
type ExecHandler interface { ExecInContainer(context.Context, *dockerapi.Client, *dockertypes.ContainerJSON, []string, io.Reader, io.WriteCloser, io.WriteCloser, time.Duration, bool) (*dockertypes.ContainerExecInspect, error) }
ExecHandler knows how to execute a command in a running Docker container.
type ExecTimeoutError ¶
type ExecTimeoutError struct{}
ExecTimeoutError is the error corresponding to the timeout in exec of the step.
func (*ExecTimeoutError) Error ¶
func (d *ExecTimeoutError) Error() string
type NativeExecHandler ¶
type NativeExecHandler struct{}
NativeExecHandler executes commands in Docker containers using Docker's exec API.
func (*NativeExecHandler) ExecInContainer ¶
func (n *NativeExecHandler) ExecInContainer(ctx context.Context, client *dockerapi.Client, container *dockertypes.ContainerJSON, cmd []string, stdin io.Reader, stdout io.WriteCloser, stderr io.WriteCloser, timeout time.Duration, tty bool) (*dockertypes.ContainerExecInspect, error)
ExecInContainer executes the provided command in the container using docker client
type RuntimeExecutor ¶
type RuntimeExecutor struct {
// contains filtered or unexported fields
}
RuntimeExecutor contains the runtime executor for docker provider.
func NewCRE ¶
func NewCRE() (*RuntimeExecutor, error)
NewCRE returns an instance of new docker container runtime executor.
func (*RuntimeExecutor) ContainerStatus ¶
func (e *RuntimeExecutor) ContainerStatus(ctx context.Context, req *runtime.ContainerStatusRequest) (*runtime.ContainerStatusResponse, error)
ContainerStatus returns status of the container. If the container is not present, returns an error.
func (*RuntimeExecutor) CreateContainer ¶
func (e *RuntimeExecutor) CreateContainer(ctx context.Context, r *runtime.CreateContainerRequest) (*runtime.CreateContainerResponse, error)
CreateContainer creates a new container Docker cannot store the log to an arbitrary location (yet), so we create an symlink at LogPath, linking to the actual path of the log.
func (*RuntimeExecutor) ExecSync ¶
func (e *RuntimeExecutor) ExecSync(ctx context.Context, r *runtime.ExecRequest) (*runtime.ExecResponse, error)
ExecSync executes the command in the docker container
func (*RuntimeExecutor) ImageStatus ¶
func (e *RuntimeExecutor) ImageStatus(ctx context.Context, r *runtime.ImageStatusRequest) (*runtime.ImageStatusResponse, error)
ImageStatus returns the status of the image. If the image is not present, returns a response with ImageStatusResponse.Image set to nil.
func (*RuntimeExecutor) ListContainers ¶
func (e *RuntimeExecutor) ListContainers(ctx context.Context, r *runtime.ListContainersRequest) (*runtime.ListContainersResponse, error)
ListContainers list all the containers that match the required criteria
func (*RuntimeExecutor) ListImages ¶
func (e *RuntimeExecutor) ListImages(ctx context.Context, r *runtime.ListImagesRequest) (*runtime.ListImagesResponse, error)
ListImages lists all the images matching the criteria in ImageRequest
func (*RuntimeExecutor) PullImage ¶
func (e *RuntimeExecutor) PullImage(ctx context.Context, r *runtime.PullImageRequest) (*runtime.PullImageResponse, error)
PullImage pulls an image with authentication config.
func (*RuntimeExecutor) RemoveContainer ¶
func (e *RuntimeExecutor) RemoveContainer(ctx context.Context, r *runtime.RemoveContainerRequest) error
RemoveContainer removes a container using the docker container runtime.
func (*RuntimeExecutor) RemoveImage ¶
func (e *RuntimeExecutor) RemoveImage(ctx context.Context, r *runtime.RemoveImageRequest) error
RemoveImage removes the image. This call is idempotent, and must not return an error if the image has already been removed.
func (*RuntimeExecutor) StartContainer ¶
func (e *RuntimeExecutor) StartContainer(ctx context.Context, r *runtime.StartContainerRequest) error
StartContainer starts running the container in context.
func (*RuntimeExecutor) Status ¶
func (e *RuntimeExecutor) Status(ctx context.Context, r *runtime.StatusRequest) (*runtime.StatusResponse, error)
Status returns the status of the underlying runtime.
func (*RuntimeExecutor) StopContainer ¶
func (e *RuntimeExecutor) StopContainer(ctx context.Context, r *runtime.StopContainerRequest) error
StopContainer stops a running container.
func (*RuntimeExecutor) Type ¶
func (e *RuntimeExecutor) Type() string
Type returns the type of the container runtime executor, for docker this is docker.
func (*RuntimeExecutor) Version ¶
func (e *RuntimeExecutor) Version(ctx context.Context, vr *runtime.VersionRequest) (*runtime.VersionResponse, error)
Version returns the version information about the cotainer runtime.