Documentation ¶
Overview ¶
Package docker contains the functions necessary to start or discover a Telepresence daemon running in a docker container.
Index ¶
- Constants
- func BuildImage(ctx context.Context, context string, buildArgs []string) (string, error)
- func CancelWhenRmFromCache(ctx context.Context, cancel context.CancelFunc, filename string) error
- func ClientImage(ctx context.Context) string
- func ContainerIP(ctx context.Context, name string) (string, 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 EnableClient(ctx context.Context) (context.Context, error)
- func EnsureNetwork(ctx context.Context, name string) error
- func EnsureVolumePlugin(ctx context.Context) error
- func GetClient(ctx context.Context) *client.Client
- 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
- func StartVolumeMounts(ctx context.Context, dcName, container string, sftpPort int32, ...) ([]string, error)
- func StopContainer(ctx context.Context, nameOrID string) error
- func StopVolumeMounts(ctx context.Context, vols []string)
Constants ¶
const TelemountPlugin = "datawire/telemount:" + runtime.GOARCH
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 CancelWhenRmFromCache ¶ added in v2.13.0
CancelWhenRmFromCache watches for the file to be removed from the cache, then calls cancel.
func ClientImage ¶
ClientImage returns the fully qualified name of the docker image that corresponds to the version of the current executable.
func ContainerIP ¶ added in v2.14.0
ContainerIP returns the IP assigned to the container with the given name on the telepresence network.
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 EnableClient ¶ added in v2.13.3
func EnsureNetwork ¶
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
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 ¶
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'.
func StartVolumeMounts ¶ added in v2.13.0
func StopContainer ¶ added in v2.13.0
func StopVolumeMounts ¶ added in v2.13.0
Types ¶
This section is empty.