docker

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package docker provides a mock for using the Docker API.

Usage:

import "github.com/go-vela/worker/mock/docker"

Index

Constants

View Source
const Version = "v1.52"

Version represents the supported Docker API version for the mock.

The Docker API version is pinned to ensure compatibility between the Docker API and client. The goal is to maintain n-1 compatibility.

The maximum supported Docker API version for the client is here:

https://docs.docker.com/engine/api/#api-version-matrix

For example (use the compatibility matrix above for reference):

* the Docker version of v29.2 has a maximum API version of v1.53 * to maintain n-1, the API version is pinned to v1.52 .

Variables

This section is empty.

Functions

func New

func New() (*mock, error)

New returns a client that is capable of handling Docker client calls and returning stub responses.

func NewStdWriter added in v0.28.0

func NewStdWriter(w io.Writer, streamType stdcopy.StdType) io.Writer

NewStdWriter instantiates a new writer using a custom format to multiplex multiple streams to a single writer. All messages written using this writer are encapsulated using a custom format, and written to the underlying stream "w".

Writers created through NewStdWriter allow for multiple write streams (e.g., stdout ([Stdout]) and stderr ([Stderr]) to be multiplexed into a single connection. "streamType" indicates the type of stream to encapsulate, commonly, [Stdout] or [Stderr]. The [Systemerr] stream can be used to include server-side errors in the stream. Information on this stream is returned as an error by [StdCopy] and terminates processing the stream.

The [Stdin] stream is present for completeness and should generally NOT be used. It is output on [Stdout] when reading the stream with [StdCopy].

All streams must share the same underlying io.Writer to ensure proper multiplexing. Each call to NewStdWriter wraps that shared writer with a header indicating the target stream.

Types

type CheckpointService added in v0.28.0

type CheckpointService struct{}

CheckpointService implements all the checkpoint related functions for the Docker mock.

func (*CheckpointService) CheckpointCreate added in v0.28.0

func (*CheckpointService) CheckpointList added in v0.28.0

func (*CheckpointService) CheckpointRemove added in v0.28.0

type ConfigService

type ConfigService struct{}

ConfigService implements all the config related functions for the Docker mock.

func (*ConfigService) ConfigCreate

ConfigCreate is a helper function to simulate a mocked call to create a config for a Docker swarm cluster.

func (*ConfigService) ConfigInspect added in v0.28.0

ConfigInspectWithRaw is a helper function to simulate a mocked call to inspect a config for a Docker swarm cluster and return the raw body received from the API.

func (*ConfigService) ConfigList

ConfigList is a helper function to simulate a mocked call to list the configs for a Docker swarm cluster.

func (*ConfigService) ConfigRemove

ConfigRemove is a helper function to simulate a mocked call to remove a config for a Docker swarm cluster.

func (*ConfigService) ConfigUpdate

ConfigUpdate is a helper function to simulate a mocked call to update a config for a Docker swarm cluster.

type ContainerService

type ContainerService struct{}

ContainerService implements all the container related functions for the Docker mock.

func (*ContainerService) ContainerAttach

ContainerAttach is a helper function to simulate a mocked call to attach a connection to a Docker container.

func (*ContainerService) ContainerCommit

ContainerCommit is a helper function to simulate a mocked call to apply changes to a Docker container.

func (*ContainerService) ContainerCreate

ContainerCreate is a helper function to simulate a mocked call to create a Docker container.

func (*ContainerService) ContainerDiff

ContainerDiff is a helper function to simulate a mocked call to show the differences in the filesystem between two Docker containers.

func (*ContainerService) ContainerExport

ContainerExport is a helper function to simulate a mocked call to expore the contents of a Docker container.

func (*ContainerService) ContainerInspect

ContainerInspect is a helper function to simulate a mocked call to inspect a Docker container.

func (*ContainerService) ContainerKill

ContainerKill is a helper function to simulate a mocked call to kill a Docker container.

func (*ContainerService) ContainerList

ContainerList is a helper function to simulate a mocked call to list Docker containers.

func (*ContainerService) ContainerLogs

ContainerLogs is a helper function to simulate a mocked call to capture the logs from a Docker container.

func (*ContainerService) ContainerPause

ContainerPause is a helper function to simulate a mocked call to pause a running Docker container.

func (*ContainerService) ContainerPrune added in v0.28.0

ContainersPrune is a helper function to simulate a mocked call to prune Docker containers.

func (*ContainerService) ContainerRemove

ContainerRemove is a helper function to simulate a mocked call to remove a Docker container.

func (*ContainerService) ContainerRename

ContainerRename is a helper function to simulate a mocked call to rename a Docker container.

func (*ContainerService) ContainerResize

ContainerResize is a helper function to simulate a mocked call to resize a Docker container.

func (*ContainerService) ContainerRestart

ContainerRestart is a helper function to simulate a mocked call to restart a Docker container.

func (*ContainerService) ContainerStart

ContainerStart is a helper function to simulate a mocked call to start a Docker container.

func (*ContainerService) ContainerStatPath

ContainerStatPath is a helper function to simulate a mocked call to capture information about a path inside a Docker container.

func (*ContainerService) ContainerStats

ContainerStats is a helper function to simulate a mocked call to capture information about a Docker container.

func (*ContainerService) ContainerStop

ContainerStop is a helper function to simulate a mocked call to stop a Docker container.

func (*ContainerService) ContainerTop

ContainerTop is a helper function to simulate a mocked call to show running processes inside a Docker container.

func (*ContainerService) ContainerUnpause

ContainerUnpause is a helper function to simulate a mocked call to unpause a Docker container.

func (*ContainerService) ContainerUpdate

ContainerUpdate is a helper function to simulate a mocked call to update a Docker container.

func (*ContainerService) ContainerWait

ContainerWait is a helper function to simulate a mocked call to wait for a running Docker container to finish.

func (*ContainerService) CopyFromContainer

CopyFromContainer is a helper function to simulate a mocked call to copy content from a Docker container.

func (*ContainerService) CopyToContainer

CopyToContainer is a helper function to simulate a mocked call to copy content to a Docker container.

type DistributionService

type DistributionService struct{}

DistributionService implements all the distribution related functions for the Docker mock.

func (*DistributionService) DistributionInspect

DistributionInspect is a helper function to simulate a mocked call to inspect a Docker image and return the digest and manifest.

type ExecService added in v0.28.0

type ExecService struct{}

ExecService implements all the exec related functions for the Docker mock.

func (*ExecService) ExecAttach added in v0.28.0

ExecAttach is a helper function to simulate a mocked call to attach to a Docker exec instance.

func (*ExecService) ExecCreate added in v0.28.0

ExecCreate is a helper function to simulate a mocked call to create a Docker exec instance.

func (*ExecService) ExecInspect added in v0.28.0

ExecInspect is a helper function to simulate a mocked call to inspect a Docker exec instance.

func (*ExecService) ExecResize added in v0.28.0

ExecResize is a helper function to simulate a mocked call to resize a Docker exec instance.

func (*ExecService) ExecStart added in v0.28.0

ExecStart is a helper function to simulate a mocked call to start a Docker exec instance.

type ImageBuildService added in v0.28.0

type ImageBuildService struct{}

ImageBuildService implements all the image build related functions for the Docker mock.

func (*ImageBuildService) BuildCachePrune added in v0.28.0

ExecInspect is a helper function to simulate a mocked call to inspect a Docker exec instance.

func (*ImageBuildService) BuildCancel added in v0.28.0

ExecResize is a helper function to simulate a mocked call to resize a Docker exec instance.

func (*ImageBuildService) ImageBuild added in v0.28.0

ExecCreate is a helper function to simulate a mocked call to create a Docker exec instance.

type ImageService

type ImageService struct{}

ImageService implements all the image related functions for the Docker mock.

func (*ImageService) ImageHistory

ImageHistory is a helper function to simulate a mocked call to inspect the history for a Docker image.

func (*ImageService) ImageImport

ImageImport is a helper function to simulate a mocked call to import a Docker image.

func (*ImageService) ImageInspect added in v0.27.0

ImageInspectWithRaw is a helper function to simulate a mocked call to inspect a Docker image and return the raw body received from the API.

func (*ImageService) ImageList

ImageList is a helper function to simulate a mocked call to list Docker images.

func (*ImageService) ImageLoad

ImageLoad is a helper function to simulate a mocked call to load a Docker image.

func (*ImageService) ImagePrune added in v0.28.0

ImagesPrune is a helper function to simulate a mocked call to prune Docker images.

func (*ImageService) ImagePull

ImagePull is a helper function to simulate a mocked call to pull a Docker image.

func (*ImageService) ImagePush

ImagePush is a helper function to simulate a mocked call to push a Docker image.

func (*ImageService) ImageRemove

ImageRemove is a helper function to simulate a mocked call to remove a Docker image.

func (*ImageService) ImageSave

ImageSave is a helper function to simulate a mocked call to save a Docker image.

func (*ImageService) ImageTag

ImageTag is a helper function to simulate a mocked call to tag a Docker image.

type NetworkService

type NetworkService struct{}

NetworkService implements all the network related functions for the Docker mock.

func (*NetworkService) NetworkConnect

NetworkConnect is a helper function to simulate a mocked call to connect to a Docker network.

func (*NetworkService) NetworkCreate

NetworkCreate is a helper function to simulate a mocked call to create a Docker network.

func (*NetworkService) NetworkDisconnect

NetworkDisconnect is a helper function to simulate a mocked call to disconnect from a Docker network.

func (*NetworkService) NetworkInspect

NetworkInspect is a helper function to simulate a mocked call to inspect a Docker network.

func (*NetworkService) NetworkList

NetworkList is a helper function to simulate a mocked call to list Docker networks.

func (*NetworkService) NetworkPrune added in v0.28.0

NetworksPrune is a helper function to simulate a mocked call to prune Docker networks.

func (*NetworkService) NetworkRemove

NetworkRemove is a helper function to simulate a mocked call to remove Docker a network.

type NodeService

type NodeService struct{}

NodeService implements all the node related functions for the Docker mock.

func (*NodeService) NodeInspect added in v0.28.0

NodeInspectWithRaw is a helper function to simulate a mocked call to inspect a node for a Docker swarm cluster and return the raw body received from the API.

func (*NodeService) NodeList

NodeList is a helper function to simulate a mocked call to list the nodes for a Docker swarm cluster.

func (*NodeService) NodeRemove

NodeRemove is a helper function to simulate a mocked call to remove a node from a Docker swarm cluster.

func (*NodeService) NodeUpdate

NodeUpdate is a helper function to simulate a mocked call to update a node for a Docker swarm cluster.

type PluginService

type PluginService struct{}

PluginService implements all the plugin related functions for the Docker mock.

func (*PluginService) PluginCreate

PluginCreate is a helper function to simulate a mocked call to create a Docker plugin.

func (*PluginService) PluginDisable

PluginDisable is a helper function to simulate a mocked call to disable a Docker plugin.

func (*PluginService) PluginEnable

PluginEnable is a helper function to simulate a mocked call to enable a Docker plugin.

func (*PluginService) PluginInspect added in v0.28.0

PluginInspectWithRaw is a helper function to simulate a mocked call to inspect a Docker plugin and return the raw body received from the API.

func (*PluginService) PluginInstall

PluginInstall is a helper function to simulate a mocked call to install a Docker plugin.

func (*PluginService) PluginList

PluginList is a helper function to simulate a mocked call to list Docker plugins.

func (*PluginService) PluginPush

PluginPush is a helper function to simulate a mocked call to push a Docker plugin.

func (*PluginService) PluginRemove

PluginRemove is a helper function to simulate a mocked call to remove a Docker plugin.

func (*PluginService) PluginSet

PluginSet is a helper function to simulate a mocked call to update settings for a Docker plugin.

func (*PluginService) PluginUpgrade

PluginUpgrade is a helper function to simulate a mocked call to upgrade a Docker plugin.

type RegistryService added in v0.28.0

type RegistryService struct{}

RegistryService implements all the registry related functions for the Docker mock.

func (*RegistryService) ImageSearch added in v0.28.0

ImageSearch is a helper function to simulate a mocked call to search for a Docker image.

type SecretService

type SecretService struct{}

SecretService implements all the secret related functions for the Docker mock.

func (*SecretService) SecretCreate

SecretCreate is a helper function to simulate a mocked call to create a secret for a Docker swarm cluster.

func (*SecretService) SecretInspect added in v0.28.0

SecretInspectWithRaw is a helper function to simulate a mocked call to inspect a Docker secret and return the raw body received from the API.

func (*SecretService) SecretList

SecretList is a helper function to simulate a mocked call to list secrets for a Docker swarm cluster.

func (*SecretService) SecretRemove

SecretRemove is a helper function to simulate a mocked call to remove a secret for a Docker swarm cluster.

func (*SecretService) SecretUpdate

SecretUpdate is a helper function to simulate a mocked call to update a secret for a Docker swarm cluster.

type ServiceService

type ServiceService struct{}

ServiceService implements all the service related functions for the Docker mock.

func (*ServiceService) ServiceCreate

ServiceCreate is a helper function to simulate a mocked call to create a service for a Docker swarm cluster.

func (*ServiceService) ServiceInspect added in v0.28.0

ServiceInspectWithRaw is a helper function to simulate a mocked call to inspect a Docker service and return the raw body received from the API.

func (*ServiceService) ServiceList

ServiceList is a helper function to simulate a mocked call to list services for a Docker swarm cluster.

func (*ServiceService) ServiceLogs

ServiceLogs is a helper function to simulate a mocked call to capture the logs from a service for a Docker swarm cluster.

func (*ServiceService) ServiceRemove

ServiceRemove is a helper function to simulate a mocked call to remove a service for a Docker swarm cluster.

func (*ServiceService) ServiceUpdate

ServiceUpdate is a helper function to simulate a mocked call to update a service for a Docker swarm cluster.

type SwarmService

type SwarmService struct{}

SwarmService implements all the swarm related functions for the Docker mock.

func (*SwarmService) SwarmGetUnlockKey

func (s *SwarmService) SwarmGetUnlockKey(_ context.Context) (client.SwarmGetUnlockKeyResult, error)

SwarmGetUnlockKey is a helper function to simulate a mocked call to capture the unlock key for a Docker swarm cluster.

func (*SwarmService) SwarmInit

SwarmInit is a helper function to simulate a mocked call to initialize the Docker swarm cluster.

func (*SwarmService) SwarmInspect

SwarmInspect is a helper function to simulate a mocked call to inspect the Docker swarm cluster.

func (*SwarmService) SwarmJoin

SwarmJoin is a helper function to simulate a mocked call to join the Docker swarm cluster.

func (*SwarmService) SwarmLeave

SwarmLeave is a helper function to simulate a mocked call to leave the Docker swarm cluster.

func (*SwarmService) SwarmUnlock

SwarmUnlock is a helper function to simulate a mocked call to unlock the Docker swarm cluster.

func (*SwarmService) SwarmUpdate

SwarmUpdate is a helper function to simulate a mocked call to update the Docker swarm cluster.

type SystemService

type SystemService struct{}

SystemService implements all the system related functions for the Docker mock.

func (*SystemService) DiskUsage

DiskUsage is a helper function to simulate a mocked call to capture the data usage from the Docker daemon.

func (*SystemService) Events

Events is a helper function to simulate a mocked call to capture the events from the Docker daemon.

func (*SystemService) Info

Info is a helper function to simulate a mocked call to capture the system information from the Docker daemon.

func (*SystemService) Ping

Ping is a helper function to simulate a mocked call to ping the Docker daemon and return version information.

func (*SystemService) RegistryLogin

RegistryLogin is a helper function to simulate a mocked call to authenticate the Docker daemon against a Docker registry.

type TaskService added in v0.28.0

type TaskService struct{}

TaskService implements all the task related functions for the Docker mock.

func (*TaskService) TaskInspect added in v0.28.0

TaskInspectWithRaw is a helper function to simulate a mocked call to inspect a task for a Docker swarm cluster and return the raw body received from the API.

func (*TaskService) TaskList added in v0.28.0

TaskList is a helper function to simulate a mocked call to list tasks for a Docker swarm cluster.

func (*TaskService) TaskLogs added in v0.28.0

TaskLogs is a helper function to simulate a mocked call to capture the logs from a task for a Docker swarm cluster.

type VolumeService

type VolumeService struct{}

VolumeService implements all the volume related functions for the Docker mock.

func (*VolumeService) VolumeCreate

VolumeCreate is a helper function to simulate a mocked call to create a Docker volume.

func (*VolumeService) VolumeInspect

VolumeInspect is a helper function to simulate a mocked call to inspect a Docker volume.

func (*VolumeService) VolumeList

VolumeList is a helper function to simulate a mocked call to list Docker volumes.

func (*VolumeService) VolumePrune added in v0.28.0

VolumesPrune is a helper function to simulate a mocked call to prune Docker volumes.

func (*VolumeService) VolumeRemove

VolumeRemove is a helper function to simulate a mocked call to remove Docker a volume.

func (*VolumeService) VolumeUpdate added in v0.22.0

VolumeUpdate is a helper function to simulate a mocked call to update Docker volumes.

Jump to

Keyboard shortcuts

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