docker

package
v1.2.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StandardLogOptions = &LoggingConfig{
	Driver: "json-file",
	Options: map[string]string{
		"max-size": "10m",
		"max-file": "1",
	},
}

Functions

func CopyFileToVolume

func CopyFileToVolume(ctx context.Context, volumeName string, sourcePath string, destPath string) error

func CopyFromContainer added in v0.0.36

func CopyFromContainer(ctx context.Context, containerName string, sourcePath string, destPath string) error

func CreateVolume

func CreateVolume(ctx context.Context, volumeName string) error

func GetImageConfig added in v1.0.2

func GetImageConfig(image string) (map[string]interface{}, error)

func GetImageDigest added in v1.0.2

func GetImageDigest(image string) (string, error)

func GetImageLabel added in v1.0.2

func GetImageLabel(image, label string) (string, error)

func MkdirInVolume

func MkdirInVolume(ctx context.Context, volumeName string, directory string) error

func RemoveVolume

func RemoveVolume(ctx context.Context, volumeName string) error

func RunDockerCommand

func RunDockerCommand(ctx context.Context, workingDir string, command ...string) error

func RunDockerCommandBuffered added in v0.0.36

func RunDockerCommandBuffered(ctx context.Context, workingDir string, command ...string) (string, error)

func RunDockerCommandRetry added in v0.0.35

func RunDockerCommandRetry(ctx context.Context, workingDir string, retries int, command ...string) error

func RunDockerComposeCommand

func RunDockerComposeCommand(ctx context.Context, workingDir string, command ...string) error

Types

type CtxComposeVersionKey added in v1.2.0

type CtxComposeVersionKey struct{}

type CtxIsLogCmdKey added in v1.2.0

type CtxIsLogCmdKey struct{}

type DependsOn

type DependsOn map[string]map[string]string

type DockerComposeConfig

type DockerComposeConfig struct {
	Version  string              `yaml:"version,omitempty"`
	Services map[string]*Service `yaml:"services,omitempty"`
	Volumes  map[string]struct{} `yaml:"volumes,omitempty"`
}

func CreateDockerCompose

func CreateDockerCompose(s *types.Stack) *DockerComposeConfig

type DockerComposeVersion added in v1.2.0

type DockerComposeVersion int
const (
	None DockerComposeVersion = iota
	ComposeV1
	ComposeV2
)

func CheckDockerConfig added in v0.0.36

func CheckDockerConfig() (DockerComposeVersion, error)

type HealthCheck

type HealthCheck struct {
	Test     []string `yaml:"test,omitempty"`
	Interval string   `yaml:"interval,omitempty"`
	Timeout  string   `yaml:"timeout,omitempty"`
	Retries  int      `yaml:"retries,omitempty"`
}

type LoggingConfig

type LoggingConfig struct {
	Driver  string            `yaml:"driver,omitempty"`
	Options map[string]string `yaml:"options,omitempty"`
}

type Service

type Service struct {
	ContainerName string                       `yaml:"container_name,omitempty"`
	Image         string                       `yaml:"image,omitempty"`
	Build         string                       `yaml:"build,omitempty"`
	User          string                       `yaml:"user,omitempty"`
	Command       string                       `yaml:"command,omitempty"`
	Environment   map[string]interface{}       `yaml:"environment,omitempty"`
	Volumes       []string                     `yaml:"volumes,omitempty"`
	Ports         []string                     `yaml:"ports,omitempty"`
	DependsOn     map[string]map[string]string `yaml:"depends_on,omitempty"`
	HealthCheck   *HealthCheck                 `yaml:"healthcheck,omitempty"`
	Logging       *LoggingConfig               `yaml:"logging,omitempty"`
	WorkingDir    string                       `yaml:"working_dir,omitempty"`
	EntryPoint    []string                     `yaml:"entrypoint,omitempty"`
	EnvFile       string                       `yaml:"env_file,omitempty"`
	Expose        []int                        `yaml:"expose,omitempty"`
}

type ServiceDefinition

type ServiceDefinition struct {
	ServiceName string
	Service     *Service
	VolumeNames []string
}

Jump to

Keyboard shortcuts

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