Documentation ¶
Overview ¶
Package dockerutil provides Docker-related utility functions. These are very specific to Lever.
Index ¶
- Constants
- Variables
- func CodeDirPath(environment, service string, codeVersion int64) string
- func ConnectToDockerEnvNetwork(docker *dockerapi.Client, containerID, networkID string) (containerIPv4 string, err error)
- func CreateDockerEnvNetwork(docker *dockerapi.Client, environment string) (networkID string, networkIPv4 string, ownIPv4 string, err error)
- func DisconnectFromDockerEnvNetwork(docker *dockerapi.Client, containerID, networkID string) error
- func GetDockerEnvIPv4(docker *dockerapi.Client, containerID, networkID string) (string, error)
- func GetOwnContainerID() string
- func GetOwnEnvIPv4(docker *dockerapi.Client, networkID string) (string, error)
- func HostCodeDirPath(environment, service string, codeVersion int64) string
- func NewDockerLocal() (docker *dockerapi.Client)
- func NewDockerSwarm() (docker *dockerapi.Client)
- func RemoveDockerContainer(docker *dockerapi.Client, containerID string) error
- func RemoveDockerEnvNetwork(docker *dockerapi.Client, networkID string) error
- func StartDockerContainer(docker *dockerapi.Client, environment string, service string, ...) (containerID string, node string, err error)
Constants ¶
const PackageName = "dockerutil"
PackageName is the name of this package.
Variables ¶
var ( // DockerSwarmFlag is the docker swarm endpoint. DockerSwarmFlag = config.DeclareString( PackageName, "dockerSwarm", "unix:///var/run/docker.sock") // DockerLocalFlag is the local docker endpoint. DockerLocalFlag = config.DeclareString( PackageName, "dockerLocal", "unix:///var/run/docker.sock") // LeverCodeHostDirFlag is the location on the host (outside docker) of the // mounted customer code directory, containing all code from all // environments and services. LeverCodeHostDirFlag = config.DeclareString( PackageName, "leverCodeHostDir", "/tmp/leveros/custcodetree") // DisableRemoveContainerFlag causes Lever containers to not be // removed (on errors, on exit etc). DisableRemoveContainerFlag = config.DeclareBool( PackageName, "disableRemoveContainer") )
Functions ¶
func CodeDirPath ¶
CodeDirPath returns the path within the docker container that the code for a given service version is found at.
func ConnectToDockerEnvNetwork ¶
func ConnectToDockerEnvNetwork( docker *dockerapi.Client, containerID, networkID string) ( containerIPv4 string, err error)
ConnectToDockerEnvNetwork connects the provided container ID to the network bridge of an environment and returns the IPv4 of the container within that network.
func CreateDockerEnvNetwork ¶
func CreateDockerEnvNetwork( docker *dockerapi.Client, environment string) ( networkID string, networkIPv4 string, ownIPv4 string, err error)
CreateDockerEnvNetwork creates the network bridge for an environment. Returns the network IPv4 of the bridge (useful for listening for connections from that bridge) as well as our own IPv4 on that network.
func DisconnectFromDockerEnvNetwork ¶
DisconnectFromDockerEnvNetwork disconnects the provided container ID from the network bridge of an environment.
func GetDockerEnvIPv4 ¶
GetDockerEnvIPv4 returns the IPv4 of a container within the network bridge of an environment.
func GetOwnContainerID ¶
func GetOwnContainerID() string
GetOwnContainerID returns the container ID of the currently running container. This assumes access to the local docker.
func GetOwnEnvIPv4 ¶
GetOwnEnvIPv4 returns the IPv4 address within the network bridge of an environment for the current process.
func HostCodeDirPath ¶
HostCodeDirPath returns the path on the docker host that the code for a given service version is found at.
func NewDockerLocal ¶
NewDockerLocal returns a client for the local docker.
func NewDockerSwarm ¶
NewDockerSwarm returns a client for the docker swarm.
func RemoveDockerContainer ¶
RemoveDockerContainer removes a Docker container which has stopped.
func RemoveDockerEnvNetwork ¶
RemoveDockerEnvNetwork removes the network bridge for an environment.
func StartDockerContainer ¶
func StartDockerContainer( docker *dockerapi.Client, environment string, service string, instanceID string, codeVersion int64, isAdmin bool, leverConfig *core.LeverConfig) ( containerID string, node string, err error)
StartDockerContainer starts a new Lever container for the specified environment and service.
Types ¶
This section is empty.