docker

package
v0.0.0-...-5705fb8 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDockerHubRepoTags

func GetDockerHubRepoTags(ctx context.Context, repo string) ([]string, error)

GetDockerHubRepoTags returns all tags for the given docker hub repository. The resulting list gets sorted in ascending order. Currently, the default behavior is to only return tags that match the pattern \d+\.\d+.

Types

type Client

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

Client is the main docker client. It is used to create other clients.

func New

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

New returns a new docker client.

func (*Client) Close

func (c *Client) Close(_ context.Context) error

Close closes the client.

func (*Client) GetAuthToken

func (c *Client) GetAuthToken() string

func (*Client) GetDockerClient

func (c *Client) GetDockerClient() *docker.Client

func (*Client) Images

func (c *Client) Images() ImageClient

func (*Client) Login

func (c *Client) Login(ctx context.Context, auth registry.AuthConfig) error

Login logs in to the docker registry using the given auth config. It uses the docker CLI to login.

func (*Client) LoginBasic

func (c *Client) LoginBasic(ctx context.Context, username, password string) error

LoginBasic logs in to the docker registry using the given username and password. It calls the Login method internally.

func (*Client) LoginFromEnv

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

LoginFromEnv logs in to the docker registry using the environment variables DOCKER_USERNAME and DOCKER_PASSWORD. It calls the LoginBasic method internally.

func (*Client) Logout

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

Logout logs out of the docker registry. This is a no-op if the client is not logged in.

NOTE: This is currently a no-op because the docker client does not support logging out. The login token is not persisted.

type ErrorDetail

type ErrorDetail struct {
	Message string `json:"message"`
}

type ErrorLine

type ErrorLine struct {
	Error       string      `json:"error"`
	ErrorDetail ErrorDetail `json:"errorDetail"`
}

type ImageClient

type ImageClient interface {
	Build(ctx context.Context, dockerfile string, tags ...string) (string, string, error)
	Push(ctx context.Context, images ...string) error
	Remove(ctx context.Context, ids ...string) error
}

ImageClient is a client for docker images. It is used to build, tag, push and remove docker images.

Jump to

Keyboard shortcuts

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