Documentation ¶
Overview ¶
Package docker contains the functions necessary to start or discover a Telepresence daemon running in a docker container.
Index ¶
- func BuildImage(ctx context.Context, context string, buildArgs []string) (string, error)
- func ClientImage(ctx context.Context) string
- func ConnectDaemon(ctx context.Context, address string) (conn *grpc.ClientConn, err error)
- func DaemonArgs(name string, port int) []string
- func DaemonOptions(ctx context.Context, name string) ([]string, *net.TCPAddr, error)
- func DiscoverDaemon(ctx context.Context, name string) (conn *grpc.ClientConn, err error)
- func EnableK8SAuthenticator(ctx context.Context) error
- func EnsureNetwork(ctx context.Context, name string)
- func LaunchDaemon(ctx context.Context, name string) (conn *grpc.ClientConn, err error)
- func PullImage(ctx context.Context, image string) error
- func SafeContainerName(name string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildImage ¶
BuildImage builds an image from source. Stdout is silenced during those operations. The image ID is returned.
func ClientImage ¶
ClientImage returns the fully qualified name of the docker image that corresponds to the version of the current executable.
func ConnectDaemon ¶
ConnectDaemon connects to a daemon at the given address.
func DaemonArgs ¶
DaemonArgs returns the arguments to pass to a docker run when starting a container daemon.
func DaemonOptions ¶
DaemonOptions returns the options necessary to pass to a docker run when starting a daemon container.
func DiscoverDaemon ¶
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 EnableK8SAuthenticator ¶
func EnsureNetwork ¶
EnsureNetwork checks if that a network with the given name exists, and creates it if that is not the case.
func LaunchDaemon ¶
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 ¶
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
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'.
Types ¶
This section is empty.