Documentation
¶
Index ¶
- Constants
- Variables
- func GetPlatformImage(ref, platform string) (string, error)
- func GetRegistry(img string) (string, error)
- func NewClient(defaultHost string) (dockerClient client.CommonAPIClient, dockerHostInRemote string, err error)
- func ParseDigest(output string) string
- type Credentials
- type CredentialsProvider
- type Opt
- type Pusher
- type PusherDockerClient
- type PusherDockerClientFactory
- type Runner
Constants ¶
const ( // DefaultHost is the standard ipv4 looback DefaultHost = "127.0.0.1" // DefaultPort is used as the preferred port, and in the unlikly event of an // error querying the OS for a free port during allocation. DefaultPort = "8080" // DefaultDialTimeout when checking if a port is available. DefaultDialTimeout = 2 * time.Second // DefaultStopTimeout when attempting to stop underlying containers. DefaultStopTimeout = 10 * time.Second )
Variables ¶
var ErrNoDocker = errors.New("docker/podman API not available")
Functions ¶
func GetPlatformImage ¶
GetPlatformImage returns image reference for specific platform. If the image is not multi-arch it returns ref argument directly (provided platform matches). If the image is multi-arch it returns digest based reference (provided the platform is part of the multi-arch image).
func GetRegistry ¶
func NewClient ¶
func NewClient(defaultHost string) (dockerClient client.CommonAPIClient, dockerHostInRemote string, err error)
NewClient creates a new docker client. reads the DOCKER_HOST envvar 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 ¶
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 Credentials ¶
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
func WithVerbose ¶
type Pusher ¶
type Pusher struct {
// contains filtered or unexported fields
}
Pusher of images from local to remote registry.
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)