docker

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComposeFormat

type ComposeFormat string

Format for compose output

const (
	// Output in JSON format
	ComposeFormat_JSON ComposeFormat = "json"

	// Output in YAML format
	ComposeFormat_YAML ComposeFormat = "yaml"
)

type DockerMockManager added in v0.2.0

type DockerMockManager struct {
	client.APIClient
	// contains filtered or unexported fields
}

func NewDockerMockManager added in v0.2.0

func NewDockerMockManager(logger *slog.Logger) *DockerMockManager

Creates a new Docker mock manager instance

func (*DockerMockManager) Config added in v0.2.0

func (d *DockerMockManager) Config(projectName string, composeFilePaths []string, format ComposeFormat) (string, error)

Emulates a `docker compose config` command, returning the YAML configuration for the provided project.

func (*DockerMockManager) ContainerInspect added in v0.2.0

func (d *DockerMockManager) ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)

Returns information about a container.

func (*DockerMockManager) ContainerList added in v0.2.0

func (d *DockerMockManager) ContainerList(ctx context.Context, options container.ListOptions) ([]types.Container, error)

Lists all running Docker containers (unless options.All is true, in which case lists all containers). The other options are not implemented.

func (*DockerMockManager) ContainerRemove added in v0.2.0

func (d *DockerMockManager) ContainerRemove(ctx context.Context, containerID string, opts container.RemoveOptions) error

Removes a container. The opts are not implemented.

func (*DockerMockManager) ContainerRestart added in v0.2.0

func (d *DockerMockManager) ContainerRestart(ctx context.Context, containerID string, opts container.StopOptions) error

Restarts a container. The opts are not implemented.

func (*DockerMockManager) ContainerStart added in v0.2.0

func (d *DockerMockManager) ContainerStart(ctx context.Context, containerID string, opts container.StartOptions) error

Starts a container. The opts are not implemented.

func (*DockerMockManager) ContainerStop added in v0.2.0

func (d *DockerMockManager) ContainerStop(ctx context.Context, containerID string, options container.StopOptions) error

Stops a container. The opts are not implemented.

func (*DockerMockManager) DiskUsage added in v0.2.0

Gets the current disk usage of each Docker resource. These must be explicitly set before calling this with Mock_SetContainerDiskUsage() or Mock_SetVolumeDiskUsage(). options are not implemented; always returns container and volume info.

func (*DockerMockManager) Down added in v0.2.0

func (d *DockerMockManager) Down(projectName string, composeFilePaths []string) error

Emulates a `docker compose down` command, stopping and removing the provided services, volumes, and networks.

func (*DockerMockManager) Mock_AddContainer added in v0.2.0

func (d *DockerMockManager) Mock_AddContainer(info types.ContainerJSON) error

Adds a container to the mock registry. Note that this does not add any new volumes the container references; add those manually with Mock_AddVolume().

func (*DockerMockManager) Mock_AddVolume added in v0.2.0

func (d *DockerMockManager) Mock_AddVolume(volume volume.Volume) error

Adds a volume to the mock registry.

func (*DockerMockManager) Mock_SetContainerDiskUsage added in v0.2.0

func (d *DockerMockManager) Mock_SetContainerDiskUsage(containerID string, sizeRootFs int64, sizeRw int64) error

Sets a container's disk usage

func (*DockerMockManager) Mock_SetVolumeDiskUsage added in v0.2.0

func (d *DockerMockManager) Mock_SetVolumeDiskUsage(volumeID string, size int64) error

Sets a container's disk usage

func (*DockerMockManager) NetworkRemove added in v0.2.0

func (d *DockerMockManager) NetworkRemove(ctx context.Context, networkID string) error

Deletes a network if not being used by existing containers.

func (*DockerMockManager) RevertToSnapshot added in v0.2.0

func (m *DockerMockManager) RevertToSnapshot(name string) error

Revert to a snapshot of the Docker mock state

func (*DockerMockManager) Stop added in v0.2.0

func (d *DockerMockManager) Stop(projectName string, composeFilePaths []string) error

Emulates a `docker compose stop` command, stopping the provided services.

func (*DockerMockManager) TakeSnapshot added in v0.2.0

func (m *DockerMockManager) TakeSnapshot(name string) error

Creates a new snapshot of the current state of the Docker mock manager

func (*DockerMockManager) Up added in v0.2.0

func (d *DockerMockManager) Up(projectName string, composeFilePaths []string) error

Emulates a `docker compose up` command, starting the provided project by generating the specified networks, volumes, and services (containers).

func (*DockerMockManager) VolumeRemove added in v0.2.0

func (d *DockerMockManager) VolumeRemove(ctx context.Context, volumeID string, force bool) error

Deletes a volume. Always works, force is not used.

Jump to

Keyboard shortcuts

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