dockerh

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: MIT Imports: 10 Imported by: 1

README

dockerh

A library to help execute docker commands from a golang binary.

Some application helpers
  • ScyllaDB

Documentation

Index

Constants

View Source
const (
	// Restarting - pod status
	Restarting PodStatus = "restarting"

	// Running - pod status
	Running PodStatus = "running"

	// Removing - pod status
	Removing PodStatus = "removing"

	// Paused - pod status
	Paused PodStatus = "paused"

	// Exited - pod status
	Exited PodStatus = "exited"

	// Dead - pod status
	Dead PodStatus = "dead"

	// DefaultnetworkInspectFormat - the default inspect format
	DefaultnetworkInspectFormat string = `(index .NetworkSettings.Networks "%s").IPAddress`
)

Variables

View Source
var (
	// ErrPodHashNotFound - raised when the output is incompatible with the hash pattern
	ErrPodHashNotFound error = errors.New("pod hash pattern was not found")

	// ErrNetworkHashNotFound - raised when the output is incompatible with the hash pattern
	ErrNetworkHashNotFound error = errors.New("network hash pattern was not found")

	// ErrPodIPNotFound - raised when the inspect format output  didn't returned any ip
	ErrPodIPNotFound error = errors.New("pod ip not found")

	// ErrPodNotListening - raised when the pod is not listening
	ErrPodNotListening error = errors.New("pod is not listening")
)

Functions

func CreateBridgeNetwork added in v1.0.1

func CreateBridgeNetwork(name string) error

CreateBridgeNetwork - creates a bridge network

func CreateCustomKafka added in v1.0.1

func CreateCustomKafka(podName, networkInspectFormat, network string, kafkaPort int, zookeeperHost string, zookeeperPort int, noConnTimeout, afterConnTimeout time.Duration) (string, error)

CreateCustomKafka - starts the kafka pod using custom configurations

func CreateCustomMysql added in v1.0.1

func CreateCustomMysql(podName, networkInspectFormat, network, password, database string, port int, moConnTimeout, afterConnTimeout time.Duration) (string, error)

CreateCustomMysql - starts the mysql pod

func CreateCustomPostgres added in v1.0.1

func CreateCustomPostgres(podName, networkInspectFormat, network, user, password, database string, port int, noConnTimeout, afterConnTimeout time.Duration) (string, error)

CreateCustomPostgres - starts the postgres pod

func CreateCustomScylla added in v1.0.1

func CreateCustomScylla(podName, networkInspectFormat, network, extraCommands string, noConnTimeout, afterConnTimeout time.Duration) (string, error)

CreateCustomScylla - starts the scylla pod

func CreateCustomZookeeper added in v1.0.1

func CreateCustomZookeeper(podName, networkInspectFormat, network string, port int, noConnTimeout, afterConnTimeout time.Duration) (string, error)

CreateCustomZookeeper - creates a zookeeper pod

func CreateKafka added in v1.0.1

func CreateKafka(podName string, kafkaPort int, zookeeperHost string, zookeeperPort int) (string, error)

CreateKafka - starts the kafka pod using default configurations

func CreateKafkaInNetwork added in v1.0.1

func CreateKafkaInNetwork(podName, network string, kafkaPort int, zookeeperHost string, zookeeperPort int) (string, error)

CreateKafkaInNetwork - starts the kafka pod using default configurations

func CreateMysql added in v1.0.1

func CreateMysql(podName, password, database string, port int) (string, error)

CreateMysql - starts the mysql pod using custom configurations

func CreateMysqlInNetwork added in v1.0.1

func CreateMysqlInNetwork(podName, network, password, database string, port int) (string, error)

CreateMysqlInNetwork - starts the mysql pod using custom configurations

func CreatePostgres added in v1.0.1

func CreatePostgres(podName, user, password, database string, port int) (string, error)

CreatePostgres - starts the postgres pod using custom configurations

func CreatePostgresInNetwork added in v1.0.1

func CreatePostgresInNetwork(podName, network, user, password, database string, port int) (string, error)

CreatePostgresInNetwork - starts the postgres pod using custom configurations

func CreateScylla added in v1.0.1

func CreateScylla(podName, extraCommands string) (string, error)

CreateScylla - starts the scylla pod using custom parameters

func CreateScyllaInNetwork added in v1.0.1

func CreateScyllaInNetwork(podName, network, extraCommands string) (string, error)

CreateScyllaInNetwork - starts the scylla pod using custom parameters

func CreateZookeeper added in v1.0.1

func CreateZookeeper(podName string, port int) (string, error)

CreateZookeeper - creates a zookeeper pod

func CreateZookeeperInNetwork added in v1.0.1

func CreateZookeeperInNetwork(podName, network string, port int) (string, error)

CreateZookeeperInNetwork - starts the kafka pod using default configurations

func Exists

func Exists(pod string, status PodStatus) (bool, error)

Exists - check if a pod exists

func Remove

func Remove(pod string) error

Remove - removes a pod

func RemoveBridgeNetwork added in v1.0.1

func RemoveBridgeNetwork(name string) error

RemoveBridgeNetwork - removes a bridge network

func Run

func Run(name, image, network, extra string) error

Run - runs a pod

func WaitUntilListeningAndGetPodIP added in v1.0.1

func WaitUntilListeningAndGetPodIP(
	podName,
	networkInspectFormat,
	network string,
	port int,
	noConnTimeout,
	afterConnTimeout time.Duration,
) (string, error)

WaitUntilListeningAndGetPodIP - wait for the pod to be listening in the specied port and returns the pod's ip

Types

type Address added in v1.0.1

type Address struct {
	Host      string
	Port      int
	Fallback  bool
	Connected bool
}

Address - some pod address

func GetIPs

func GetIPs(networkInspectFormat, network string, pod ...string) ([]Address, error)

GetIPs - return the pod's ips

func NewAddress added in v1.0.1

func NewAddress(host string, port int, fallback bool) Address

NewAddress - creates a new address

func WaitUntilListening

func WaitUntilListening(noConnTimeout, afterConnTimeout time.Duration, addresses ...Address) []Address

WaitUntilListening - wait some pod(s) to be listening

func (Address) GetAddress added in v1.0.1

func (a Address) GetAddress() string

type PodStatus

type PodStatus string

PodStatus - the pod status to be filtered

Jump to

Keyboard shortcuts

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