dockermgmt

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EnvoyProxy = "envoy"
View Source
var NginxProxy = "nginx"
View Source
var SingleOpts = map[string]struct{}{
	"-d":                      {},
	"--detach":                {},
	"--disable-content-trust": {},
	"--help":                  {},
	"--init":                  {},
	"-i":                      {},
	"--interactive":           {},
	"--no-healthcheck":        {},
	"--oom-kill-disable":      {},
	"--privileged":            {},
	"-P":                      {},
	"--publish-all":           {},
	"--read-only":             {},
	"--rm":                    {},
	"--sig-proxy":             {},
	"-t":                      {},
	"--tty":                   {},
}

SingleOpts are docker run options that take no option value.

View Source
var UseInternalPortInContainer = "internalPort"
View Source
var UsePublicPortInContainer = "publicPort"

Functions

func ArgsMatchRunning

func ArgsMatchRunning(ctx context.Context, runningData types.ContainerJSON, runArgs []string) bool

Attempt to see if running container matches the desired run state from the args. On updates, this is used to decide if the container needs to be stopped and started to apply new run args. Note: ports are not checked because we use host network mode, and so ports are never specified.

func CreateAppInst

func CreateAppInst(ctx context.Context, accessApi platform.AccessApi, client ssh.Client, app *edgeproto.App, appInst *edgeproto.AppInst, opts ...DockerReqOp) error

func CreateAppInstLocal

func CreateAppInstLocal(ctx context.Context, client ssh.Client, app *edgeproto.App, appInst *edgeproto.AppInst) error

Local Docker AppInst create is different due to fact that MacOS doesn't like '--network=host' option. Instead on MacOS docker needs to have port mapping explicity specified with '-p' option. As a result we have a separate function specifically for a docker app creation on a MacOS laptop TODO: Replace this with CreateAppInst with WithExportPorts() and WithNoHostNetwork() options.

func DeleteAppInst

func DeleteAppInst(ctx context.Context, accessApi platform.AccessApi, client ssh.Client, app *edgeproto.App, appInst *edgeproto.AppInst, opts ...DockerReqOp) error

func DockerImagePresent

func DockerImagePresent(ctx context.Context, client ssh.Client, image string) (bool, error)

func GetAppInstRuntime

func GetAppInstRuntime(ctx context.Context, client ssh.Client, app *edgeproto.App, appInst *edgeproto.AppInst) (*edgeproto.AppInstRuntime, error)

func GetContainerCommand

func GetContainerCommand(clusterInst *edgeproto.ClusterInst, app *edgeproto.App, appInst *edgeproto.AppInst, req *edgeproto.ExecRequest) (string, error)

func GetContainerName

func GetContainerName(appInst *edgeproto.AppInst) string

func GetDockerPortString

func GetDockerPortString(ports []dme.AppPort, containerPortType string, proxyMatch, listenIP, listenIPV6 string) []string

Helper function that generates the ports string for docker command Example : "-p 80:80/http -p 7777:7777/tcp"

func SeedDockerSecret

func SeedDockerSecret(ctx context.Context, client ssh.Client, imagePath string, authAPI cloudcommon.RegistryAuthApi) error

func UpdateAppInst

func UpdateAppInst(ctx context.Context, accessApi platform.AccessApi, client ssh.Client, app *edgeproto.App, appInst *edgeproto.AppInst) error

Types

type DockerNetworkingMode

type DockerNetworkingMode string
var DockerBridgeMode DockerNetworkingMode = "bridgeMode"
var DockerHostMode DockerNetworkingMode = "hostMode"

type DockerOptions

type DockerOptions struct {
	ForceImagePull  bool
	ExposePorts     bool
	NoHostNetwork   bool
	StopTimeoutSecs int
}

type DockerReqOp

type DockerReqOp func(do *DockerOptions) error

func WithExposePorts

func WithExposePorts() DockerReqOp

func WithForceImagePull

func WithForceImagePull(force bool) DockerReqOp

func WithNoHostNetwork

func WithNoHostNetwork() DockerReqOp

func WithStopTimeoutSecs

func WithStopTimeoutSecs(timeoutSecs int) DockerReqOp

Jump to

Keyboard shortcuts

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