Documentation
¶
Overview ¶
Package docker contains the functions necessary to start or discover a Telepresence daemon running in a docker container.
Index ¶
- Constants
- Variables
- func BuildImage(ctx context.Context, context string, buildArgs []string) (string, error)
- func ClientImage(ctx context.Context) string
- func ConnectDaemon(ctx context.Context, address netip.AddrPort) (conn *grpc.ClientConn, err error)
- func CreateVolumes(ctx context.Context, hostPort netip.AddrPort, remoteContainer string, ...) (map[string]string, error)
- func DaemonArgs(ctx context.Context, daemonID *daemon.Identifier) []string
- func DaemonOptions(ctx context.Context, daemonID *daemon.Identifier, hostAddr netip.AddrPort) (opts []string, err error)
- func EnableClient(ctx context.Context) context.Context
- func EnsureNetworkPlugin(ctx context.Context) (string, error)
- func EnsureVolumePlugin(ctx context.Context) (string, error)
- func GetClient(ctx context.Context) (*client.Client, error)
- func GetDaemonContainerNetworkInfo(ctx context.Context) (dns netip.Addr, networkName string, err error)
- func LaunchDaemon(ctx context.Context, daemonID *daemon.Identifier) (info *daemon.Info, conn *grpc.ClientConn, err error)
- func NetworkPluginName(ctx context.Context) string
- func PullImage(ctx context.Context, image string) error
- func RemoveVolumes(ctx context.Context, vols []string)
- func StopContainer(ctx context.Context, nameOrID string) error
- func WaitForExit(ctx context.Context, cli *dockerClient.Client, id string, ...) error
- type ContainerInfo
Constants ¶
const ( TpCache = "/root/.cache/telepresence" DockerTpConfig = "/root/.config/telepresence" DockerTpLog = "/root/.cache/telepresence/logs" )
const Exe = "docker"
Variables ¶
var ClientImageName = telepresenceImage //nolint:gochecknoglobals // extension point
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 containerized daemon at the given address.
func CreateVolumes ¶ added in v2.23.0
func CreateVolumes( ctx context.Context, hostPort netip.AddrPort, remoteContainer string, mounts types.MountPolicies, ro bool, ) (map[string]string, error)
CreateVolumes creates the volumes necessary when mounting volumes required by when engaging the remote container. The hostPort is the <daemon ip>/<sftp port> where the access to the remote sftp-server is provided. The mounts are provided as a map of mount policies keyed by paths. Each volume is given the name of the remote container suffixed by a dash and a sequence number, starting at 0. Returns a map of paths keyed by volume names.
func DaemonArgs ¶
func DaemonArgs(ctx context.Context, daemonID *daemon.Identifier) []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, hostAddr netip.AddrPort) (opts []string, err error)
DaemonOptions returns the options necessary to pass to a docker run when starting a daemon container.
func EnsureNetworkPlugin ¶ added in v2.23.0
EnsureNetworkPlugin checks if the telemount plugin is installed and installs it if that is not the case. The plugin is also enabled.
func EnsureVolumePlugin ¶ added in v2.13.0
EnsureVolumePlugin checks if the telemount plugin is installed and installs it if that is not the case. The plugin is also enabled.
func GetDaemonContainerNetworkInfo ¶ added in v2.23.3
func GetDaemonContainerNetworkInfo(ctx context.Context) (dns netip.Addr, networkName string, err error)
GetDaemonContainerNetworkInfo checks if the daemon VIF routes any subnets. If it does, then the DNS IP assigned to the VIF and the network name of the teleroute network is returned. Otherwise, the method returns the daemon's IP on the default bridge as the DNS address and an empty string as the network name.
func LaunchDaemon ¶
func LaunchDaemon(ctx context.Context, daemonID *daemon.Identifier) (info *daemon.Info, 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 NetworkPluginName ¶ added in v2.23.0
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 RemoveVolumes ¶ added in v2.23.0
func StopContainer ¶ added in v2.13.0
func WaitForExit ¶ added in v2.23.0
Types ¶
type ContainerInfo ¶ added in v2.23.0
func GetContainerInfo ¶ added in v2.23.0
GetContainerInfo returns the name and process ID of the container with the given ID along with its associated IP in the given network.
Directories
¶
Path | Synopsis |
---|---|
Package teleroute contains the Telepresence Daemon Teleroute service that the Docker Network Plugin with the same name connects to.
|
Package teleroute contains the Telepresence Daemon Teleroute service that the Docker Network Plugin with the same name connects to. |