Documentation
¶
Overview ¶
Package dockerutil docket util
Index ¶
- func GenerateBytesUUID() []byte
- func GenerateSplitLogs(logName string) error
- type Composition
- func (c *Composition) Decompose(dir string) (output string, err error)
- func (c *Composition) GenerateLogs(dir, logName string) error
- func (c *Composition) GetAPIContainerForComposeService(composeService string) (apiContainer *docker.APIContainers, err error)
- func (c *Composition) GetContainerIDs(dir string) (containerIDs []string, err error)
- func (c *Composition) GetIPAddressForComposeService(composeService string) (ipAddress string, err error)
- type DockerHelper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateBytesUUID ¶
func GenerateBytesUUID() []byte
GenerateBytesUUID returns a UUID based on RFC 4122 returning the generated bytes.
func GenerateSplitLogs ¶
GenerateSplitLogs generates a log file named logName, formatted similarly to docker-compose logs, but without all the output from all the containers being mixed in together. Each container has all its output in one section of the log, for easy reading.
Types ¶
type Composition ¶
type Composition struct { DockerClient *docker.Client APIContainers []*docker.APIContainers ComposeFilesYaml string ProjectName string Dir string DockerHelper DockerHelper }
Composition represents a docker-compose execution and management.
func NewComposition ¶
func NewComposition(projectName, composeFilesYaml, dir string) (composition *Composition, err error)
NewComposition create a new Composition specifying the project name (for isolation) and the compose files.
func (*Composition) Decompose ¶
func (c *Composition) Decompose(dir string) (output string, err error)
Decompose decompose the composition. Will also remove any containers with the same ProjectName prefix (eg. chaincode containers).
func (*Composition) GenerateLogs ¶
func (c *Composition) GenerateLogs(dir, logName string) error
GenerateLogs to file.
func (*Composition) GetAPIContainerForComposeService ¶
func (c *Composition) GetAPIContainerForComposeService( composeService string) (apiContainer *docker.APIContainers, err error)
GetAPIContainerForComposeService return the docker.APIContainers with the supplied composeService name.
func (*Composition) GetContainerIDs ¶
func (c *Composition) GetContainerIDs(dir string) (containerIDs []string, err error)
GetContainerIDs returns the container IDs for the composition. (NOTE: does NOT include those defined outside composition, eg. chaincode containers).
func (*Composition) GetIPAddressForComposeService ¶
func (c *Composition) GetIPAddressForComposeService(composeService string) (ipAddress string, err error)
GetIPAddressForComposeService returns the IPAddress of the container with the supplied composeService name.
type DockerHelper ¶
type DockerHelper interface { GetIPAddress(containerID string) (string, error) RemoveContainersWithNamePrefix(namePrefix string) error }
DockerHelper helper for docker specific functions.
func NewDockerCmdlineHelper ¶
func NewDockerCmdlineHelper() DockerHelper
NewDockerCmdlineHelper returns a new command line DockerHelper instance.