docker

package
v2.18.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Overview

Package docker contains the functions necessary to start or discover a Telepresence daemon running in a docker container.

Index

Constants

View Source
const TelemountPlugin = "datawire/telemount:" + runtime.GOARCH
View Source
const (
	TpCache = "/root/.cache/telepresence"
)

Variables

View Source
var ClientImageName = telepresenceImage //nolint:gochecknoglobals // extension point

Functions

func BuildImage

func BuildImage(ctx context.Context, context string, buildArgs []string) (string, error)

BuildImage builds an image from source. Stdout is silenced during those operations. The image ID is returned.

func ClientImage

func ClientImage(ctx context.Context) string

ClientImage returns the fully qualified name of the docker image that corresponds to the version of the current executable.

func ConnectDaemon

func ConnectDaemon(ctx context.Context, address string) (conn *grpc.ClientConn, err error)

ConnectDaemon connects to a containerized daemon at the given address.

func ContainerIP added in v2.14.0

func ContainerIP(ctx context.Context, name string) (string, error)

ContainerIP returns the IP assigned to the container with the given name on the telepresence network.

func DaemonArgs

func DaemonArgs(daemonID *daemon.Identifier, port int) []string

DaemonArgs returns the arguments to pass to a docker run when starting a container daemon.

func DaemonOptions

func DaemonOptions(ctx context.Context, daemonID *daemon.Identifier) ([]string, *net.TCPAddr, error)

DaemonOptions returns the options necessary to pass to a docker run when starting a daemon container.

func EnableClient added in v2.13.3

func EnableClient(ctx context.Context) context.Context

func EnsureNetwork

func EnsureNetwork(ctx context.Context, name string) error

EnsureNetwork checks if a network with the given name exists, and creates it if that is not the case.

func EnsureVolumePlugin added in v2.13.0

func EnsureVolumePlugin(ctx context.Context) error

EnsureVolumePlugin checks if the datawire/telemount plugin is installed and installs it if that is not the case. The plugin is also enabled.

func GetClient added in v2.13.3

func GetClient(ctx context.Context) (*client.Client, error)

func LaunchDaemon

func LaunchDaemon(ctx context.Context, daemonID *daemon.Identifier) (conn *grpc.ClientConn, err error)

LaunchDaemon ensures that the image returned by ClientImage exists by calling PullImage. It then uses the options DaemonOptions and DaemonArgs to start the image, and finally connectDaemon to connect to it. A successful start yields a cache.Info entry in the cache.

func PullImage

func PullImage(ctx context.Context, image string) error

PullImage checks if the given image exists locally by doing docker image inspect. A docker pull is performed if no local image is found. Stdout is silenced during those operations.

func StartVolumeMounts added in v2.13.0

func StartVolumeMounts(ctx context.Context, dcName, container string, sftpPort int32, mounts, vols []string) ([]string, error)

func StopContainer added in v2.13.0

func StopContainer(ctx context.Context, nameOrID string) error

func StopVolumeMounts added in v2.13.0

func StopVolumeMounts(ctx context.Context, vols []string)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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