Documentation ¶
Overview ¶
Package dockerengine provides functionality to interact with the Docker server.
Package dockerengine is a generated GoMock package.
Index ¶
- Constants
- Variables
- func PlatformString(os, arch string) string
- type BuildArguments
- type Cmd
- type DockerCmdClient
- func (c DockerCmdClient) Build(ctx context.Context, in *BuildArguments, w io.Writer) error
- func (c DockerCmdClient) CheckDockerEngineRunning() error
- func (c DockerCmdClient) GetPlatform() (os, arch string, err error)
- func (c DockerCmdClient) IsEcrCredentialHelperEnabled(uri string) bool
- func (c DockerCmdClient) Login(uri, username, password string) error
- func (c DockerCmdClient) Push(ctx context.Context, uri string, w io.Writer, tags ...string) (digest string, err error)
- type ErrDockerDaemonNotResponsive
- type MockCmd
- type MockCmdMockRecorder
Constants ¶
const ( OSLinux = "linux" OSWindows = "windows" ArchAMD64 = "amd64" ArchX86 = "x86_64" ArchARM = "arm" ArchARM64 = "arm64" )
Operating systems and architectures supported by docker.
Variables ¶
var ErrDockerCommandNotFound = errors.New("docker: command not found")
ErrDockerCommandNotFound means the docker command is not found.
Functions ¶
func PlatformString ¶ added in v1.12.0
PlatformString returns a specified of the format <os>/<arch>.
Types ¶
type BuildArguments ¶
type BuildArguments struct { URI string // Required. Location of ECR Repo. Used to generate image name in conjunction with tag. Tags []string // Required. List of tags to apply to the image. Dockerfile string // Required. Dockerfile to pass to `docker build` via --file flag. Context string // Optional. Build context directory to pass to `docker build`. Target string // Optional. The target build stage to pass to `docker build`. CacheFrom []string // Optional. Images to consider as cache sources to pass to `docker build` Platform string // Optional. OS/Arch to pass to `docker build`. Args map[string]string // Optional. Build args to pass via `--build-arg` flags. Equivalent to ARG directives in dockerfile. Labels map[string]string // Required. Set metadata for an image. }
BuildArguments holds the arguments that can be passed while building a container.
func (*BuildArguments) GenerateDockerBuildArgs ¶ added in v1.28.0
func (in *BuildArguments) GenerateDockerBuildArgs(c DockerCmdClient) ([]string, error)
GenerateDockerBuildArgs returns command line arguments to be passed to the Docker build command based on the provided BuildArguments. Returns an error if no tags are provided for building an image.
type Cmd ¶
type Cmd interface { Run(name string, args []string, options ...exec.CmdOption) error RunWithContext(ctx context.Context, name string, args []string, opts ...exec.CmdOption) error }
Cmd is the interface implemented by external commands.
type DockerCmdClient ¶ added in v1.28.0
type DockerCmdClient struct {
// contains filtered or unexported fields
}
DockerCmdClient represents the docker client to interact with the server via external commands.
func New ¶
func New(cmd Cmd) DockerCmdClient
New returns CmdClient to make requests against the Docker daemon via external commands.
func (DockerCmdClient) Build ¶ added in v1.28.0
func (c DockerCmdClient) Build(ctx context.Context, in *BuildArguments, w io.Writer) error
Build will run a `docker build` command for the given ecr repo URI and build arguments.
func (DockerCmdClient) CheckDockerEngineRunning ¶ added in v1.28.0
func (c DockerCmdClient) CheckDockerEngineRunning() error
CheckDockerEngineRunning will run `docker info` command to check if the docker engine is running.
func (DockerCmdClient) GetPlatform ¶ added in v1.28.0
func (c DockerCmdClient) GetPlatform() (os, arch string, err error)
GetPlatform will run the `docker version` command to get the OS/Arch.
func (DockerCmdClient) IsEcrCredentialHelperEnabled ¶ added in v1.28.0
func (c DockerCmdClient) IsEcrCredentialHelperEnabled(uri string) bool
IsEcrCredentialHelperEnabled return true if ecr-login is enabled either globally or registry level
func (DockerCmdClient) Login ¶ added in v1.28.0
func (c DockerCmdClient) Login(uri, username, password string) error
Login will run a `docker login` command against the Service repository URI with the input uri and auth data.
type ErrDockerDaemonNotResponsive ¶
type ErrDockerDaemonNotResponsive struct {
// contains filtered or unexported fields
}
ErrDockerDaemonNotResponsive means the docker daemon is not responsive.
func (ErrDockerDaemonNotResponsive) Error ¶
func (e ErrDockerDaemonNotResponsive) Error() string
type MockCmd ¶
type MockCmd struct {
// contains filtered or unexported fields
}
MockCmd is a mock of Cmd interface.
func NewMockCmd ¶
func NewMockCmd(ctrl *gomock.Controller) *MockCmd
NewMockCmd creates a new mock instance.
func (*MockCmd) EXPECT ¶
func (m *MockCmd) EXPECT() *MockCmdMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockCmdMockRecorder ¶
type MockCmdMockRecorder struct {
// contains filtered or unexported fields
}
MockCmdMockRecorder is the mock recorder for MockCmd.
func (*MockCmdMockRecorder) Run ¶
func (mr *MockCmdMockRecorder) Run(name, args interface{}, options ...interface{}) *gomock.Call
Run indicates an expected call of Run.
func (*MockCmdMockRecorder) RunWithContext ¶ added in v1.28.0
func (mr *MockCmdMockRecorder) RunWithContext(ctx, name, args interface{}, opts ...interface{}) *gomock.Call
RunWithContext indicates an expected call of RunWithContext.