docker

package
v0.0.0-...-758283c Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoDocker = errors.New("docker API not available")

Functions

func GetRegistry

func GetRegistry(img string) (string, error)

func NewClient

func NewClient(defaultHost string) (dockerClient client.CommonAPIClient, dockerHostInRemote string, err error)

NewClient creates a new docker client. reads the DOCKER_HOST env-var but it may or may not return it as dockerHost.

  • For local connection (unix socket and windows named pipe) it returns the DOCKER_HOST directly.
  • For ssh connections it reads the DOCKER_HOST from the ssh remote.
  • For TCP connections it returns "" so it defaults in the remote (note that one should not be use client.DefaultDockerHost in this situation). This is needed beaus of TCP+tls connections.

func ParseDigest

func ParseDigest(output string) string

ParseDigest tries to parse the last line from the output, which holds the pushed image digest The output should contain line like this: latest: digest: sha256:a278a91112d17f8bde6b5f802a3317c7c752cf88078dae6f4b5a0784deb81782 size: 2613

Types

type AuthConfig

type AuthConfig struct {
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
	Auth     string `json:"auth,omitempty"`

	// Email is an optional value associated with the username.
	// This field is deprecated and will be removed in a later
	// version of docker.
	Email string `json:"email,omitempty"`

	ServerAddress string `json:"serveraddress,omitempty"`

	// IdentityToken is used to authenticate the user and get
	// an access token for the registry.
	IdentityToken string `json:"identitytoken,omitempty"`

	// RegistryToken is a bearer token to be sent to a registry
	RegistryToken string `json:"registrytoken,omitempty"`
}

AuthConfig contains authorization information for connecting to a Registry.

type Credentials

type Credentials struct {
	Username string
	Password string
}

func EmptyCredentialsProvider

func EmptyCredentialsProvider(ctx context.Context, registry string) (Credentials, error)

type CredentialsProvider

type CredentialsProvider func(ctx context.Context, image string) (Credentials, error)

type Opt

type Opt func(*Pusher)

func WithCredentialsProvider

func WithCredentialsProvider(cp CredentialsProvider) Opt

func WithPusherDockerClientFactory

func WithPusherDockerClientFactory(dockerClientFactory PusherDockerClientFactory) Opt

func WithTransport

func WithTransport(transport http.RoundTripper) Opt

type Pusher

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

Pusher of images from local to remote registry.

func NewPusher

func NewPusher(opts ...Opt) *Pusher

NewPusher creates an instance of a docker-based image pusher.

func (*Pusher) Push

func (n *Pusher) Push(ctx context.Context, f *dubbo.Dubbo) (digest string, err error)

Push the image of the function.

type PusherDockerClient

type PusherDockerClient interface {
	daemon.Client
	ImagePush(ctx context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error)
	Close() error
}

PusherDockerClient is sub-interface of client.CommonAPIClient required by pusher.

type PusherDockerClientFactory

type PusherDockerClientFactory func() (PusherDockerClient, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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