docker

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Secret added in v0.7.0

func Secret(server, user, pass, email string) ([]byte, error)

Secret generates a docker registry secret that can be stored as a k8s secret and used to pull images from docker hub (or any other registry) in an authenticated manner. The format if the []byte in string form will be

{
  "auths": {
    "[SERVER]": {
      "username": "[USER]",
      "password": "[PASS]",
      "email": "[EMAIL]",
      "auth"; "[base64 encoding of 'user:pass']"
    }
  }
}

Types

type Client

type Client interface {
	ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *ocispec.Platform, containerName string) (container.CreateResponse, error)
	ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
	ContainerRemove(ctx context.Context, container string, options container.RemoveOptions) error
	ContainerStart(ctx context.Context, container string, options container.StartOptions) error
	ContainerStop(ctx context.Context, container string, options container.StopOptions) error
	CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, container.PathStat, error)

	ContainerExecCreate(ctx context.Context, container string, config container.ExecOptions) (types.IDResponse, error)
	ContainerExecInspect(ctx context.Context, execID string) (container.ExecInspect, error)
	ContainerExecStart(ctx context.Context, execID string, config container.ExecStartOptions) error

	ImageList(ctx context.Context, options image.ListOptions) ([]image.Summary, error)
	ImagePull(ctx context.Context, refStr string, options image.PullOptions) (io.ReadCloser, error)

	ServerVersion(ctx context.Context) (types.Version, error)
	VolumeInspect(ctx context.Context, volumeID string) (volume.Volume, error)
	Info(ctx context.Context) (system.Info, error)
}

Client interface for testing purposes. Includes only the methods used by the underlying docker package.

type Docker

type Docker struct {
	Client Client
}

Docker for handling communication with the docker processes. Can be created with default settings by calling New or with a custom Client by manually instantiating this type.

func New

func New(ctx context.Context) (*Docker, error)

New returns a new Docker type with a default Client implementation.

func (*Docker) Version

func (d *Docker) Version(ctx context.Context) (Version, error)

Version returns the version information from the underlying docker process.

type Version

type Version struct {
	// Version is the platform version
	Version string
	// Arch is the platform architecture
	Arch string
	// Platform is the platform name
	Platform string
}

Version contains al the version information that is being tracked.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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