Documentation ¶
Index ¶
- func DefaultDockerCLIOptions() []command.DockerCliOption
- type Container
- type Docker
- func (d *Docker) Auth(ctx context.Context, ref reference.NamedTagged, cmdName string) (string, types.RequestPrivilegeFunc, error)
- func (d *Docker) Build(eg *errgroup.Group, ctx context.Context, dockerContext io.Reader, ...) error
- func (d *Docker) ImageExists(ctx context.Context, imageURL string) (bool, error)
- func (d *Docker) ImageList(ctx context.Context) ([]types.ImageSummary, error)
- func (d *Docker) Logs(ctx context.Context, containerID string) (io.ReadCloser, error)
- func (d *Docker) ParseURL(url string) (reference.NamedTagged, error)
- func (d *Docker) PullImage(ctx context.Context, imageURL string) error
- func (d *Docker) PushImage(ctx context.Context, imageURL string) error
- func (d *Docker) RepoGetTags(ctx context.Context, imageURL string) ([]string, error)
- func (d *Docker) RepoImageExists(ctx context.Context, imageURL string) (bool, error)
- func (d *Docker) RepoInfo(ref reference.NamedTagged) (*registry.RepositoryInfo, error)
- func (d *Docker) Start(eg *errgroup.Group, ctx context.Context, opts StartOptions) (containerID string, finish func(), err error)
- func (d *Docker) StartBuildkitSession(eg *errgroup.Group, ctx context.Context, ...) (*session.Session, error)
- func (d *Docker) StreamLogs(stdout, stderr io.Writer, logs io.Reader) error
- func (d *Docker) Wait(ctx context.Context, containerID string, condition WaitCondition) error
- type StartOptions
- type WaitCondition
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultDockerCLIOptions ¶
func DefaultDockerCLIOptions() []command.DockerCliOption
DefaultDockerCLIOptions returns default docker cli options which attach cli streams to stdio
Types ¶
type Container ¶
type Container interface { ParseURL(url string) (reference.NamedTagged, error) RepoInfo(ref reference.NamedTagged) (*registry.RepositoryInfo, error) Auth(ctx context.Context, ref reference.NamedTagged, cmdName string) (string, types.RequestPrivilegeFunc, error) PullImage(ctx context.Context, imageURL string) error PushImage(ctx context.Context, imageURL string) error RepoGetTags(ctx context.Context, imageURL string) ([]string, error) RepoImageExists(ctx context.Context, imageURL string) (bool, error) ImageList(ctx context.Context) ([]types.ImageSummary, error) ImageExists(ctx context.Context, imageURL string) (bool, error) Start(eg *errgroup.Group, ctx context.Context, opts StartOptions) (string, func(), error) Wait(ctx context.Context, containerID string, condition WaitCondition) error Logs(ctx context.Context, containerID string) (io.ReadCloser, error) StreamLogs(stdout, stderr io.Writer, logs io.Reader) error }
Container a generic interface representing container system interactions
type Docker ¶
Docker an implementation of the container interface
func NewDockerClient ¶
func NewDockerClient(cliOptions ...command.DockerCliOption) (*Docker, error)
NewDockerClient returns an instance of the Docker container interface
func (*Docker) Auth ¶
func (d *Docker) Auth(ctx context.Context, ref reference.NamedTagged, cmdName string) (string, types.RequestPrivilegeFunc, error)
Auth returns credentials for operations that require authentication
func (*Docker) Build ¶
func (d *Docker) Build(eg *errgroup.Group, ctx context.Context, dockerContext io.Reader, opts types.ImageBuildOptions) error
Build starts a docker build
func (*Docker) ImageExists ¶
ImageExists returns true if an image exists locally
func (*Docker) ParseURL ¶
func (d *Docker) ParseURL(url string) (reference.NamedTagged, error)
ParseURL returns a docker repository reference from a given url string
func (*Docker) RepoGetTags ¶
RepoGetTags searches a remote repository and lists all tags for that image
func (*Docker) RepoImageExists ¶
RepoImageExists searches for the existence of an image in a remote repo
func (*Docker) RepoInfo ¶
func (d *Docker) RepoInfo(ref reference.NamedTagged) (*registry.RepositoryInfo, error)
RepoInfo returns the repository information for a given image reference
func (*Docker) Start ¶
func (d *Docker) Start(eg *errgroup.Group, ctx context.Context, opts StartOptions) (containerID string, finish func(), err error)
Start starts a docker container using the given image reference. The finish callback must be executed for this function's error group to complete, exiting the run
Example:
containerID, finish, err := docker.Start() defer finish()
func (*Docker) StartBuildkitSession ¶
func (d *Docker) StartBuildkitSession(eg *errgroup.Group, ctx context.Context, secretSpecs []secretsprovider.FileSource, key string) (*session.Session, error)
StartBuildkitSession func (d *Docker) StartBuildkitSession(ctx context.Context, key string, sshSpecs []string, secretSpecs []string) (*session.Session, error) {
func (*Docker) StreamLogs ¶
StreamLogs streams logs to the given destinations
type StartOptions ¶
type StartOptions struct { AutoRemove bool AttachStdIn bool Privileged bool Image string WorkingDir string ContainerName string Binds []string Cmd []string Env map[string]string PortBindings nat.PortMap ExposedPorts nat.PortSet KillTimeout time.Duration InputStream io.Reader OutputStream io.Writer NetworkMode string }
StartOptions options for the container.Start method
type WaitCondition ¶
type WaitCondition string
WaitCondition provides specificity to the type of string recognized as a container wait condition
const ( // WaitConditionNotRunning defines the 'not-running' condition to check while waiting WaitConditionNotRunning WaitCondition = "not-running" )