docker

package
v2.13.2-rc.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: Apache-2.0 Imports: 39 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

This section is empty.

Variables

This section is empty.

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 CancelWhenRmFromCache added in v2.13.0

func CancelWhenRmFromCache(ctx context.Context, cancel context.CancelFunc, filename string) error

CancelWhenRmFromCache watches for the file to be removed from the cache, then calls cancel.

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 DaemonArgs

func DaemonArgs(name string, 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, name string) ([]string, *net.TCPAddr, error)

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

func DiscoverDaemon

func DiscoverDaemon(ctx context.Context, name string) (conn *grpc.ClientConn, err error)

DiscoverDaemon searches the daemon cache for an entry corresponding to the given name. A connection to that daemon is returned if such an entry is found.

func EnsureNetwork

func EnsureNetwork(ctx context.Context, name string)

EnsureNetwork checks if that 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 LaunchDaemon

func LaunchDaemon(ctx context.Context, name string) (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.DaemonInfo 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 SafeContainerName added in v2.12.1

func SafeContainerName(name string) string

SafeContainerName returns a string that can safely be used as an argument to docker run --name. Only characters [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed. Others are replaced by an underscore, or if it's the very first character, by the character 'a'.

func StartVolumeMounts added in v2.13.0

func StartVolumeMounts(ctx context.Context, dcName, container string, sftpPort int32, mounts, vols, args []string) ([]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