docker

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: May 13, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	DockerClient *client.Client
	AuthConfig   registry.AuthConfig
	AuthStr      string
	Config       ClientConfig
}

Client represents a Docker client with all necessary operations

func NewClient

func NewClient(cfg ClientConfig) (*Client, error)

NewClient creates a new Docker client with the given configuration

func (*Client) Close

func (c *Client) Close() error

Close closes the Docker client

func (*Client) GetImageInfo

func (c *Client) GetImageInfo(ctx context.Context, imageName string) (*ImageReference, error)

GetImageInfo retrieves information about a Docker image

func (*Client) PullImage

func (c *Client) PullImage(ctx context.Context, imageName string) error

PullImage pulls a Docker image with retry logic

func (*Client) PushImage

func (c *Client) PushImage(ctx context.Context, imageName string) error

PushImage pushes a Docker image with retry logic

func (*Client) TagImage

func (c *Client) TagImage(ctx context.Context, source, target string) error

TagImage tags a Docker image

func (*Client) VerifyCredentials

func (c *Client) VerifyCredentials(ctx context.Context) error

VerifyCredentials verifies Docker registry credentials

type ClientConfig

type ClientConfig struct {
	Username    string
	Password    string
	Repository  string
	RetryCount  int
	RetryDelay  time.Duration
	PullTimeout time.Duration
	PushTimeout time.Duration
	APIVersion  string
	TLSVerify   bool
	CertPath    string
}

ClientConfig holds configuration for a Docker client

func DefaultClientConfig

func DefaultClientConfig() ClientConfig

DefaultClientConfig returns a default configuration for Docker clients

type ClientInterface

type ClientInterface interface {
	PullImage(ctx context.Context, imageName string) error
	TagImage(ctx context.Context, source, target string) error
	PushImage(ctx context.Context, imageName string) error
	VerifyCredentials(ctx context.Context) error
	GetImageInfo(ctx context.Context, imageName string) (*ImageReference, error)
	Close() error
}

ClientInterface defines the interface for Docker operations

type ImageReference

type ImageReference struct {
	Registry   string
	Repository string
	Name       string
	Tag        string
	Digest     string
	FullName   string
}

ImageReference represents a Docker image reference

type SyncOperation

type SyncOperation struct {
	Source     ImageReference
	Target     ImageReference
	StartTime  time.Time
	EndTime    time.Time
	Status     string
	Error      error
	RetryCount int
	BytesMoved int64
	ChecksumOK bool
}

SyncOperation represents a sync operation between source and target images

Jump to

Keyboard shortcuts

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