docker

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIVersionFlag

func APIVersionFlag(v *viper.Viper, f *pflag.FlagSet)

APIVersionFlag register flag for docker API version

func GetAPIVersion

func GetAPIVersion(v *viper.Viper) string

func GetHost

func GetHost(v *viper.Viper) string

func GetPortBindings

func GetPortBindings(port string, container *dockertypes.ContainerJSON) ([]nat.PortBinding, error)

GetPortBindings returns the list of port binding to access container on given port

func HostFlag

func HostFlag(v *viper.Viper, f *pflag.FlagSet)

HostFlag register flag for docker host

func NewClient

func NewClient(cfg *ClientConfig) (*docker.Client, error)

func ParseVolumes

func ParseVolumes(specs ...string) (volumes map[string]struct{}, binds []string, err error)

Types

type ClientConfig

type ClientConfig struct {
	Host    string
	Version string
	Client  *kilnhttp.ClientConfig
}

func ClientConfigFromViper

func ClientConfigFromViper(v *viper.Viper) *ClientConfig

func (*ClientConfig) SetDefault

func (cfg *ClientConfig) SetDefault() *ClientConfig

type Compose

type Compose struct {
	// contains filtered or unexported fields
}

func NewCompose

func NewCompose(cfg *ComposeConfig) (*Compose, error)

func (*Compose) Down

func (c *Compose) Down(ctx context.Context) error

func (*Compose) GetContainer

func (c *Compose) GetContainer(ctx context.Context, name string) (*dockertypes.ContainerJSON, error)

func (*Compose) Name

func (c *Compose) Name(name string) string

func (*Compose) RegisterNetwork

func (c *Compose) RegisterNetwork(name string, cfg *dockertypes.NetworkCreate)

func (*Compose) RegisterService

func (c *Compose) RegisterService(name string, cfg *ServiceConfig)

func (*Compose) RegisterVolume

func (c *Compose) RegisterVolume(name string, cfg dockervolume.VolumeCreateBody)

func (*Compose) SetLogger

func (c *Compose) SetLogger(logger logrus.FieldLogger)

func (*Compose) Up

func (c *Compose) Up(ctx context.Context) error

func (*Compose) WaitContainer

func (c *Compose) WaitContainer(ctx context.Context, name string, timeout time.Duration) error

type ComposeConfig

type ComposeConfig struct {
	Client    *ClientConfig
	Namespace string
}

func (*ComposeConfig) SetDefault

func (cfg *ComposeConfig) SetDefault() *ComposeConfig

type FoundryServiceOpts added in v0.5.0

type FoundryServiceOpts struct {
	Port, Entrypoint, Image string
	Env                     []string
}

func (*FoundryServiceOpts) SetDefault added in v0.5.0

func (opts *FoundryServiceOpts) SetDefault() *FoundryServiceOpts

type PostgresServiceOpts

type PostgresServiceOpts struct {
	Version, Port, User, Password string
}

func (*PostgresServiceOpts) SQLConfig

func (opts *PostgresServiceOpts) SQLConfig(container *dockertypes.ContainerJSON) (*kilnsql.Config, error)

SQLConfig returns an SQL config to connect to the postgres container from the host

func (*PostgresServiceOpts) SetDefault

func (opts *PostgresServiceOpts) SetDefault() *PostgresServiceOpts

type ServiceConfig

type ServiceConfig struct {
	Name       string
	Container  *dockercontainer.Config
	Host       *dockercontainer.HostConfig
	Networking *dockernetwork.NetworkingConfig
	IsReady    func(context.Context, *dockertypes.ContainerJSON) error
	DependsOn  []string
}

func NewFoundryServiceConfig added in v0.5.0

func NewFoundryServiceConfig(opts *FoundryServiceOpts) (*ServiceConfig, error)

func NewPostgresServiceConfig

func NewPostgresServiceConfig(opts *PostgresServiceOpts) (*ServiceConfig, error)

func NewTreafikServiceConfig

func NewTreafikServiceConfig(opts *TraefikServiceOpts) (*ServiceConfig, error)

type TraefikServiceOpts

type TraefikServiceOpts struct {
	Version, Port string
}

func (*TraefikServiceOpts) Addr

func (opts *TraefikServiceOpts) Addr(container *dockertypes.ContainerJSON) (string, error)

Addr returns address to connect to the traefik container from the host

func (*TraefikServiceOpts) SetDefault

func (opts *TraefikServiceOpts) SetDefault() *TraefikServiceOpts

Jump to

Keyboard shortcuts

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