dockerengine

package
v1.24.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package dockerengine provides functionality to interact with the Docker server.

Package dockerengine is a generated GoMock package.

Index

Constants

View Source
const (
	OSLinux   = "linux"
	OSWindows = "windows"

	ArchAMD64 = "amd64"
	ArchX86   = "x86_64"
	ArchARM   = "arm"
	ArchARM64 = "arm64"
)

Operating systems and architectures supported by docker.

Variables

View Source
var ErrDockerCommandNotFound = errors.New("docker: command not found")

ErrDockerCommandNotFound means the docker command is not found.

Functions

func PlatformString added in v1.12.0

func PlatformString(os, arch string) string

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          // Optional. List of tags to apply to the image besides "latest".
	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.
}

BuildArguments holds the arguments that can be passed while building a container.

type Cmd

type Cmd interface {
	Run(name string, args []string, options ...exec.CmdOption) error
}

Cmd is the interface implemented by external commands.

type CmdClient

type CmdClient struct {
	// contains filtered or unexported fields
}

CmdClient represents the docker client to interact with the server via external commands.

func New

func New(cmd Cmd) CmdClient

New returns CmdClient to make requests against the Docker daemon via external commands.

func (CmdClient) Build

func (c CmdClient) Build(in *BuildArguments) error

Build will run a `docker build` command for the given ecr repo URI and build arguments.

func (CmdClient) CheckDockerEngineRunning

func (c CmdClient) CheckDockerEngineRunning() error

CheckDockerEngineRunning will run `docker info` command to check if the docker engine is running.

func (CmdClient) GetPlatform added in v1.12.0

func (c CmdClient) GetPlatform() (os, arch string, err error)

GetPlatform will run the `docker version` command to get the OS/Arch.

func (CmdClient) IsEcrCredentialHelperEnabled

func (c CmdClient) IsEcrCredentialHelperEnabled(uri string) bool

IsEcrCredentialHelperEnabled return true if ecr-login is enabled either globally or registry level

func (CmdClient) Login

func (c CmdClient) 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.

func (CmdClient) Push

func (c CmdClient) Push(uri string, tags ...string) (digest string, err error)

Push pushes the images with the specified tags and ecr repository URI, and returns the image digest on success.

type ErrDockerDaemonNotResponsive

type ErrDockerDaemonNotResponsive struct {
	// contains filtered or unexported fields
}

ErrDockerDaemonNotResponsive means the docker daemon is not responsive.

func (ErrDockerDaemonNotResponsive) Error

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.

func (*MockCmd) Run

func (m *MockCmd) Run(name string, args []string, options ...exec.CmdOption) error

Run mocks base method.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL