types

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//PullPolicyAlways always pull images
	PullPolicyAlways = "always"
	//PullPolicyNever never pull images
	PullPolicyNever = "never"
	//PullPolicyIfNotPresent pull missing images
	PullPolicyIfNotPresent = "if_not_present"
	//PullPolicyMissing pull missing images
	PullPolicyMissing = "missing"
	//PullPolicyBuild force building images
	PullPolicyBuild = "build"
)
View Source
const (
	//RestartPolicyAlways always restart the container if it stops
	RestartPolicyAlways = "always"
	//RestartPolicyOnFailure restart the container if it exits due to an error
	RestartPolicyOnFailure = "on-failure"
	//RestartPolicyNo do not automatically restart the container
	RestartPolicyNo = "no"
	//RestartPolicyUnlessStopped always restart the container unless the container is stopped (manually or otherwise)
	RestartPolicyUnlessStopped = "unless-stopped"
)
View Source
const (
	// ServicePrefix is the prefix for references pointing to a service
	ServicePrefix = "service:"
	// ContainerPrefix is the prefix for references pointing to a container
	ContainerPrefix = "container:"

	// NetworkModeServicePrefix is the prefix for network_mode pointing to a service
	// Deprecated prefer ServicePrefix
	NetworkModeServicePrefix = ServicePrefix
	// NetworkModeContainerPrefix is the prefix for network_mode pointing to a container
	// Deprecated prefer ContainerPrefix
	NetworkModeContainerPrefix = ContainerPrefix
)
View Source
const (
	// VolumeTypeBind is the type for mounting host dir
	VolumeTypeBind = "bind"
	// VolumeTypeVolume is the type for remote storage volumes
	VolumeTypeVolume = "volume"
	// VolumeTypeTmpfs is the type for mounting tmpfs
	VolumeTypeTmpfs = "tmpfs"
	// VolumeTypeNamedPipe is the type for mounting Windows named pipes
	VolumeTypeNamedPipe = "npipe"
)
View Source
const (
	// PropagationRPrivate RPRIVATE
	PropagationRPrivate string = "rprivate"
	// PropagationPrivate PRIVATE
	PropagationPrivate string = "private"
	// PropagationRShared RSHARED
	PropagationRShared string = "rshared"
	// PropagationShared SHARED
	PropagationShared string = "shared"
	// PropagationRSlave RSLAVE
	PropagationRSlave string = "rslave"
	// PropagationSlave SLAVE
	PropagationSlave string = "slave"
)

Propagation represents the propagation of a mount.

View Source
const (
	// ServiceConditionCompletedSuccessfully is the type for waiting until a service has completed successfully (exit code 0).
	ServiceConditionCompletedSuccessfully = "service_completed_successfully"

	// ServiceConditionHealthy is the type for waiting until a service is healthy.
	ServiceConditionHealthy = "service_healthy"

	// ServiceConditionStarted is the type for waiting until a service has started (default).
	ServiceConditionStarted = "service_started"
)

Variables

This section is empty.

Functions

func ConvertDurationPtr

func ConvertDurationPtr(d *Duration) *time.Duration

ConvertDurationPtr converts a type defined Duration pointer to a time.Duration pointer with the same value.

Types

type BlkioConfig

type BlkioConfig struct {
	Weight          uint16           `yaml:",omitempty" json:"weight,omitempty"`
	WeightDevice    []WeightDevice   `yaml:",omitempty" json:"weight_device,omitempty"`
	DeviceReadBps   []ThrottleDevice `yaml:",omitempty" json:"device_read_bps,omitempty"`
	DeviceReadIOps  []ThrottleDevice `yaml:",omitempty" json:"device_read_iops,omitempty"`
	DeviceWriteBps  []ThrottleDevice `yaml:",omitempty" json:"device_write_bps,omitempty"`
	DeviceWriteIOps []ThrottleDevice `yaml:",omitempty" json:"device_write_iops,omitempty"`

	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

BlkioConfig define blkio config

type BuildConfig

type BuildConfig struct {
	Context    string            `yaml:",omitempty" json:"context,omitempty"`
	Dockerfile string            `yaml:",omitempty" json:"dockerfile,omitempty"`
	Args       MappingWithEquals `yaml:",omitempty" json:"args,omitempty"`
	Labels     Labels            `yaml:",omitempty" json:"labels,omitempty"`
	CacheFrom  StringList        `mapstructure:"cache_from" yaml:"cache_from,omitempty" json:"cache_from,omitempty"`
	ExtraHosts HostsList         `mapstructure:"extra_hosts" yaml:"extra_hosts,omitempty" json:"extra_hosts,omitempty"`
	Isolation  string            `yaml:",omitempty" json:"isolation,omitempty"`
	Network    string            `yaml:",omitempty" json:"network,omitempty"`
	Target     string            `yaml:",omitempty" json:"target,omitempty"`

	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

BuildConfig is a type for build

type Config

type Config struct {
	Filename   string     `yaml:"-" json:"-"`
	Services   Services   `json:"services"`
	Networks   Networks   `yaml:",omitempty" json:"networks,omitempty"`
	Volumes    Volumes    `yaml:",omitempty" json:"volumes,omitempty"`
	Secrets    Secrets    `yaml:",omitempty" json:"secrets,omitempty"`
	Configs    Configs    `yaml:",omitempty" json:"configs,omitempty"`
	Extensions Extensions `yaml:",inline" json:"-"`
}

Config is a full compose file configuration and model

func (Config) MarshalJSON

func (c Config) MarshalJSON() ([]byte, error)

MarshalJSON makes Config implement json.Marshaler

type ConfigDetails

type ConfigDetails struct {
	Version     string
	WorkingDir  string
	ConfigFiles []ConfigFile
	Environment map[string]string
}

ConfigDetails are the details about a group of ConfigFiles

func (ConfigDetails) LookupEnv

func (cd ConfigDetails) LookupEnv(key string) (string, bool)

LookupEnv provides a lookup function for environment variables

type ConfigFile

type ConfigFile struct {
	// Filename is the name of the yaml configuration file
	Filename string
	// Content is the raw yaml content. Will be loaded from Filename if not set
	Content []byte
	// Config if the yaml tree for this config file. Will be parsed from Content if not set
	Config map[string]interface{}
}

ConfigFile is a filename and the contents of the file as a Dict

type ConfigObjConfig

type ConfigObjConfig FileObjectConfig

ConfigObjConfig is the config for the swarm "Config" object

type Configs

type Configs map[string]ConfigObjConfig

Configs is a map of ConfigObjConfig

type CredentialSpecConfig

type CredentialSpecConfig struct {
	Config     string                 `yaml:",omitempty" json:"config,omitempty"` // Config was added in API v1.40
	File       string                 `yaml:",omitempty" json:"file,omitempty"`
	Registry   string                 `yaml:",omitempty" json:"registry,omitempty"`
	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

CredentialSpecConfig for credential spec on Windows

type DependsOnConfig

type DependsOnConfig map[string]ServiceDependency

type DeviceRequest

type DeviceRequest struct {
	Capabilities []string `mapstructure:"capabilities" yaml:"capabilities,omitempty" json:"capabilities,omitempty"`
	Driver       string   `mapstructure:"driver" yaml:"driver,omitempty" json:"driver,omitempty"`
	Count        int64    `mapstructure:"count" yaml:"count,omitempty" json:"count,omitempty"`
	IDs          []string `mapstructure:"device_ids" yaml:"device_ids,omitempty" json:"device_ids,omitempty"`
}

type DiscreteGenericResource

type DiscreteGenericResource struct {
	Kind  string `json:"kind"`
	Value int64  `json:"value"`

	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

DiscreteGenericResource represents a "user defined" resource which is defined as an integer "Kind" is used to describe the Kind of a resource (e.g: "GPU", "FPGA", "SSD", ...) Value is used to count the resource (SSD=5, HDD=3, ...)

type Duration

type Duration time.Duration

Duration is a thin wrapper around time.Duration with improved JSON marshalling

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON makes Duration implement json.Marshaler

func (Duration) MarshalYAML

func (d Duration) MarshalYAML() (interface{}, error)

MarshalYAML makes Duration implement yaml.Marshaler

func (Duration) String

func (d Duration) String() string

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

type ExtendsConfig

type ExtendsConfig MappingWithEquals

type Extensions

type Extensions map[string]interface{}

Extensions is a map of custom extension

func (Extensions) Get

func (e Extensions) Get(name string, target interface{}) (bool, error)

type External

type External struct {
	Name       string                 `yaml:",omitempty" json:"name,omitempty"`
	External   bool                   `yaml:",omitempty" json:"external,omitempty"`
	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

External identifies a Volume or Network as a reference to a resource that is not managed, and should already exist. External.name is deprecated and replaced by Volume.name

func (External) MarshalJSON

func (e External) MarshalJSON() ([]byte, error)

MarshalJSON makes External implement json.Marshaller

func (External) MarshalYAML

func (e External) MarshalYAML() (interface{}, error)

MarshalYAML makes External implement yaml.Marshaller

type FileObjectConfig

type FileObjectConfig struct {
	Name           string                 `yaml:",omitempty" json:"name,omitempty"`
	File           string                 `yaml:",omitempty" json:"file,omitempty"`
	External       External               `yaml:",omitempty" json:"external,omitempty"`
	Labels         Labels                 `yaml:",omitempty" json:"labels,omitempty"`
	Driver         string                 `yaml:",omitempty" json:"driver,omitempty"`
	DriverOpts     map[string]string      `mapstructure:"driver_opts" yaml:"driver_opts,omitempty" json:"driver_opts,omitempty"`
	TemplateDriver string                 `mapstructure:"template_driver" yaml:"template_driver,omitempty" json:"template_driver,omitempty"`
	Extensions     map[string]interface{} `yaml:",inline" json:"-"`
}

FileObjectConfig is a config type for a file used by a service

type FileReferenceConfig

type FileReferenceConfig struct {
	Source string  `yaml:",omitempty" json:"source,omitempty"`
	Target string  `yaml:",omitempty" json:"target,omitempty"`
	UID    string  `yaml:",omitempty" json:"uid,omitempty"`
	GID    string  `yaml:",omitempty" json:"gid,omitempty"`
	Mode   *uint32 `yaml:",omitempty" json:"mode,omitempty"`

	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

FileReferenceConfig for a reference to a swarm file object

type GenericResource

type GenericResource struct {
	DiscreteResourceSpec *DiscreteGenericResource `mapstructure:"discrete_resource_spec" yaml:"discrete_resource_spec,omitempty" json:"discrete_resource_spec,omitempty"`

	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

GenericResource represents a "user defined" resource which can only be an integer (e.g: SSD=3) for a service

type HealthCheckConfig

type HealthCheckConfig struct {
	Test        HealthCheckTest `yaml:",omitempty" json:"test,omitempty"`
	Timeout     *Duration       `yaml:",omitempty" json:"timeout,omitempty"`
	Interval    *Duration       `yaml:",omitempty" json:"interval,omitempty"`
	Retries     *uint64         `yaml:",omitempty" json:"retries,omitempty"`
	StartPeriod *Duration       `mapstructure:"start_period" yaml:"start_period,omitempty" json:"start_period,omitempty"`
	Disable     bool            `yaml:",omitempty" json:"disable,omitempty"`

	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

HealthCheckConfig the healthcheck configuration for a service

type HealthCheckTest

type HealthCheckTest []string

HealthCheckTest is the command run to test the health of a service

type HostsList

type HostsList []string

HostsList is a list of colon-separated host-ip mappings

type IPAMConfig

type IPAMConfig struct {
	Driver     string                 `yaml:",omitempty" json:"driver,omitempty"`
	Config     []*IPAMPool            `yaml:",omitempty" json:"config,omitempty"`
	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

IPAMConfig for a network

type IPAMPool

type IPAMPool struct {
	Subnet             string                 `yaml:",omitempty" json:"subnet,omitempty"`
	Gateway            string                 `yaml:",omitempty" json:"gateway,omitempty"`
	IPRange            string                 `mapstructure:"ip_range" yaml:"ip_range,omitempty" json:"ip_range,omitempty"`
	AuxiliaryAddresses map[string]string      `mapstructure:"aux_addresses" yaml:"aux_addresses,omitempty" json:"aux_addresses,omitempty"`
	Extensions         map[string]interface{} `yaml:",inline" json:"-"`
}

IPAMPool for a network

type Labels

type Labels map[string]string

Labels is a mapping type for labels

func (Labels) Add

func (l Labels) Add(key, value string) Labels

type LoggingConfig

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

	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

LoggingConfig the logging configuration for a service

type Mapping

type Mapping map[string]string

Mapping is a mapping type that can be converted from a list of key[=value] strings. For the key with an empty value (`key=`), or key without value (`key`), the mapped value is set to an empty string `""`.

func NewMapping

func NewMapping(values []string) Mapping

NewMapping build a new Mapping from a set of KEY=VALUE strings

type MappingWithColon

type MappingWithColon map[string]string

MappingWithColon is a mapping type that can be converted from a list of 'key: value' strings

type MappingWithEquals

type MappingWithEquals map[string]*string

MappingWithEquals is a mapping type that can be converted from a list of key[=value] strings. For the key with an empty value (`key=`), the mapped value is set to a pointer to `""`. For the key without value (`key`), the mapped value is set to nil.

func NewMappingWithEquals

func NewMappingWithEquals(values []string) MappingWithEquals

NewMappingWithEquals build a new Mapping from a set of KEY=VALUE strings

func (MappingWithEquals) OverrideBy

OverrideBy update MappingWithEquals with values from another MappingWithEquals

func (MappingWithEquals) RemoveEmpty

func (e MappingWithEquals) RemoveEmpty() MappingWithEquals

RemoveEmpty excludes keys that are not associated with a value

func (MappingWithEquals) Resolve

func (e MappingWithEquals) Resolve(lookupFn func(string) (string, bool)) MappingWithEquals

Resolve update a MappingWithEquals for keys without value (`key`, but not `key=`)

type NetworkConfig

type NetworkConfig struct {
	Name       string                 `yaml:",omitempty" json:"name,omitempty"`
	Driver     string                 `yaml:",omitempty" json:"driver,omitempty"`
	DriverOpts map[string]string      `mapstructure:"driver_opts" yaml:"driver_opts,omitempty" json:"driver_opts,omitempty"`
	Ipam       IPAMConfig             `yaml:",omitempty" json:"ipam,omitempty"`
	External   External               `yaml:",omitempty" json:"external,omitempty"`
	Internal   bool                   `yaml:",omitempty" json:"internal,omitempty"`
	Attachable bool                   `yaml:",omitempty" json:"attachable,omitempty"`
	Labels     Labels                 `yaml:",omitempty" json:"labels,omitempty"`
	EnableIPv6 bool                   `mapstructure:"enable_ipv6" yaml:"enable_ipv6,omitempty" json:"enable_ipv6,omitempty"`
	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

NetworkConfig for a network

type Networks

type Networks map[string]NetworkConfig

Networks is a map of NetworkConfig

type PlacementPreferences

type PlacementPreferences struct {
	Spread string `yaml:",omitempty" json:"spread,omitempty"`

	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

PlacementPreferences is the preferences for a service placement

type Project

type Project struct {
	Name         string            `yaml:"-" json:"-"`
	WorkingDir   string            `yaml:"-" json:"-"`
	Services     Services          `json:"services"`
	Networks     Networks          `yaml:",omitempty" json:"networks,omitempty"`
	Volumes      Volumes           `yaml:",omitempty" json:"volumes,omitempty"`
	Secrets      Secrets           `yaml:",omitempty" json:"secrets,omitempty"`
	Configs      Configs           `yaml:",omitempty" json:"configs,omitempty"`
	Extensions   Extensions        `yaml:",inline" json:"-"` // https://github.com/golang/go/issues/6213
	ComposeFiles []string          `yaml:"-" json:"-"`
	Environment  map[string]string `yaml:"-" json:"-"`

	// DisabledServices track services which have been disable as profile is not active
	DisabledServices Services `yaml:"-" json:"-"`
}

Project is the result of loading a set of compose files

func (Project) AllServices

func (p Project) AllServices() Services

func (*Project) ApplyProfiles

func (p *Project) ApplyProfiles(profiles []string)

ApplyProfiles disables service which don't match selected profiles

func (Project) ConfigNames

func (p Project) ConfigNames() []string

ConfigNames return names for all configs in this Compose config

func (*Project) ForServices

func (p *Project) ForServices(names []string) error

ForServices restrict the project model to a subset of services

func (Project) GetService

func (p Project) GetService(name string) (ServiceConfig, error)

GetService retrieve a specific service by name

func (Project) GetServices

func (p Project) GetServices(names ...string) (Services, error)

GetServices retrieve services by names, or return all services if no name specified

func (Project) NetworkNames

func (p Project) NetworkNames() []string

NetworkNames return names for all volumes in this Compose config

func (*Project) RelativePath

func (p *Project) RelativePath(path string) string

RelativePath resolve a relative path based project's working directory

func (*Project) ResolveImages

func (p *Project) ResolveImages(resolver func(named reference.Named) (digest.Digest, error)) error

ResolveImages updates services images to include digest computed by a resolver function

func (Project) SecretNames

func (p Project) SecretNames() []string

SecretNames return names for all secrets in this Compose config

func (Project) ServiceNames

func (p Project) ServiceNames() []string

ServiceNames return names for all services in this Compose config

func (Project) VolumeNames

func (p Project) VolumeNames() []string

VolumeNames return names for all volumes in this Compose config

func (Project) WithServices

func (p Project) WithServices(names []string, fn ServiceFunc) error

WithServices run ServiceFunc on each service and dependencies in dependency order

func (*Project) WithoutUnnecessaryResources

func (p *Project) WithoutUnnecessaryResources()

WithoutUnnecessaryResources drops networks/volumes/secrets/configs that are not referenced by active services

type Resource

type Resource struct {
	// TODO: types to convert from units and ratios
	NanoCPUs         string            `mapstructure:"cpus" yaml:"cpus,omitempty" json:"cpus,omitempty"`
	MemoryBytes      UnitBytes         `mapstructure:"memory" yaml:"memory,omitempty" json:"memory,omitempty"`
	Devices          []DeviceRequest   `mapstructure:"devices" yaml:"devices,omitempty" json:"devices,omitempty"`
	GenericResources []GenericResource `mapstructure:"generic_resources" yaml:"generic_resources,omitempty" json:"generic_resources,omitempty"`

	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

Resource is a resource to be limited or reserved

type SecretConfig

type SecretConfig FileObjectConfig

SecretConfig for a secret

type Secrets

type Secrets map[string]SecretConfig

Secrets is a map of SecretConfig

type ServiceConfig

type ServiceConfig struct {
	Name     string   `yaml:"-" json:"-"`
	Profiles []string `mapstructure:"profiles" yaml:"profiles,omitempty" json:"profiles,omitempty"`

	Build               *BuildConfig                     `yaml:",omitempty" json:"build,omitempty"`
	BlkioConfig         *BlkioConfig                     `mapstructure:"blkio_config" yaml:",omitempty" json:"blkio_config,omitempty"`
	CapAdd              []string                         `mapstructure:"cap_add" yaml:"cap_add,omitempty" json:"cap_add,omitempty"`
	CapDrop             []string                         `mapstructure:"cap_drop" yaml:"cap_drop,omitempty" json:"cap_drop,omitempty"`
	CgroupParent        string                           `mapstructure:"cgroup_parent" yaml:"cgroup_parent,omitempty" json:"cgroup_parent,omitempty"`
	CPUCount            int64                            `mapstructure:"cpu_count" yaml:"cpu_count,omitempty" json:"cpu_count,omitempty"`
	CPUPercent          float32                          `mapstructure:"cpu_percent" yaml:"cpu_percent,omitempty" json:"cpu_percent,omitempty"`
	CPUPeriod           int64                            `mapstructure:"cpu_period" yaml:"cpu_period,omitempty" json:"cpu_period,omitempty"`
	CPUQuota            int64                            `mapstructure:"cpu_quota" yaml:"cpu_quota,omitempty" json:"cpu_quota,omitempty"`
	CPURTPeriod         int64                            `mapstructure:"cpu_rt_period" yaml:"cpu_rt_period,omitempty" json:"cpu_rt_period,omitempty"`
	CPURTRuntime        int64                            `mapstructure:"cpu_rt_runtime" yaml:"cpu_rt_runtime,omitempty" json:"cpu_rt_runtime,omitempty"`
	CPUS                float32                          `mapstructure:"cpus" yaml:"cpus,omitempty" json:"cpus,omitempty"`
	CPUSet              string                           `mapstructure:"cpuset" yaml:"cpuset,omitempty" json:"cpuset,omitempty"`
	CPUShares           int64                            `mapstructure:"cpu_shares" yaml:"cpu_shares,omitempty" json:"cpu_shares,omitempty"`
	Command             ShellCommand                     `yaml:",omitempty" json:"command,omitempty"`
	Configs             []ServiceConfigObjConfig         `yaml:",omitempty" json:"configs,omitempty"`
	ContainerName       string                           `mapstructure:"container_name" yaml:"container_name,omitempty" json:"container_name,omitempty"`
	CredentialSpec      *CredentialSpecConfig            `mapstructure:"credential_spec" yaml:"credential_spec,omitempty" json:"credential_spec,omitempty"`
	InitContainerPolicy string                           `mapstructure:"init_container_policy" yaml:"init_container_policy,omitempty" json:"init_container_policy,omitempty"`
	InitContainer       Services                         `json:"init_container,omitempty" yaml:"init_container,omitempty"`
	DependsOn           DependsOnConfig                  `mapstructure:"depends_on" yaml:"depends_on,omitempty" json:"depends_on,omitempty"`
	Devices             []string                         `yaml:",omitempty" json:"devices,omitempty"`
	DNS                 StringList                       `yaml:",omitempty" json:"dns,omitempty"`
	DNSOpts             []string                         `mapstructure:"dns_opt" yaml:"dns_opt,omitempty" json:"dns_opt,omitempty"`
	DNSSearch           StringList                       `mapstructure:"dns_search" yaml:"dns_search,omitempty" json:"dns_search,omitempty"`
	Dockerfile          string                           `yaml:"dockerfile,omitempty" json:"dockerfile,omitempty"`
	DomainName          string                           `mapstructure:"domainname" yaml:"domainname,omitempty" json:"domainname,omitempty"`
	Entrypoint          ShellCommand                     `yaml:",omitempty" json:"entrypoint,omitempty"`
	Environment         MappingWithEquals                `yaml:",omitempty" json:"environment,omitempty"`
	EnvFile             StringList                       `mapstructure:"env_file" yaml:"env_file,omitempty" json:"env_file,omitempty"`
	Expose              StringOrNumberList               `yaml:",omitempty" json:"expose,omitempty"`
	Extends             ExtendsConfig                    `yaml:"extends,omitempty" json:"extends,omitempty"`
	ExternalLinks       []string                         `mapstructure:"external_links" yaml:"external_links,omitempty" json:"external_links,omitempty"`
	ExtraHosts          HostsList                        `mapstructure:"extra_hosts" yaml:"extra_hosts,omitempty" json:"extra_hosts,omitempty"`
	GroupAdd            []string                         `mapstructure:"group_add" yaml:"group_add,omitempty" json:"group_add,omitempty"`
	Hostname            string                           `yaml:",omitempty" json:"hostname,omitempty"`
	HealthCheck         *HealthCheckConfig               `yaml:",omitempty" json:"healthcheck,omitempty"`
	Image               string                           `yaml:",omitempty" json:"image,omitempty"`
	Init                *bool                            `yaml:",omitempty" json:"init,omitempty"`
	Ipc                 string                           `yaml:",omitempty" json:"ipc,omitempty"`
	Isolation           string                           `mapstructure:"isolation" yaml:"isolation,omitempty" json:"isolation,omitempty"`
	Labels              Labels                           `yaml:",omitempty" json:"labels,omitempty"`
	CustomLabels        Labels                           `yaml:"-" json:"-"`
	Links               []string                         `yaml:",omitempty" json:"links,omitempty"`
	Logging             *LoggingConfig                   `yaml:",omitempty" json:"logging,omitempty"`
	LogDriver           string                           `mapstructure:"log_driver" yaml:"log_driver,omitempty" json:"log_driver,omitempty"`
	LogOpt              map[string]string                `mapstructure:"log_opt" yaml:"log_opt,omitempty" json:"log_opt,omitempty"`
	MemLimit            UnitBytes                        `mapstructure:"mem_limit" yaml:"mem_limit,omitempty" json:"mem_limit,omitempty"`
	MemReservation      UnitBytes                        `mapstructure:"mem_reservation" yaml:"mem_reservation,omitempty" json:"mem_reservation,omitempty"`
	MemSwapLimit        UnitBytes                        `mapstructure:"memswap_limit" yaml:"memswap_limit,omitempty" json:"memswap_limit,omitempty"`
	MemSwappiness       UnitBytes                        `mapstructure:"mem_swappiness" yaml:"mem_swappiness,omitempty" json:"mem_swappiness,omitempty"`
	MacAddress          string                           `mapstructure:"mac_address" yaml:"mac_address,omitempty" json:"mac_address,omitempty"`
	Net                 string                           `yaml:"net,omitempty" json:"net,omitempty"`
	NetworkMode         string                           `mapstructure:"network_mode" yaml:"network_mode,omitempty" json:"network_mode,omitempty"`
	Networks            map[string]*ServiceNetworkConfig `yaml:",omitempty" json:"networks,omitempty"`
	OomKillDisable      bool                             `mapstructure:"oom_kill_disable" yaml:"oom_kill_disable,omitempty" json:"oom_kill_disable,omitempty"`
	OomScoreAdj         int64                            `mapstructure:"oom_score_adj" yaml:"oom_score_adj,omitempty" json:"oom_score_adj,omitempty"`
	Pid                 string                           `yaml:",omitempty" json:"pid,omitempty"`
	PidsLimit           int64                            `mapstructure:"pids_limit" yaml:"pids_limit,omitempty" json:"pids_limit,omitempty"`
	Platform            string                           `yaml:",omitempty" json:"platform,omitempty"`
	Ports               []ServicePortConfig              `yaml:",omitempty" json:"ports,omitempty"`
	Privileged          bool                             `yaml:",omitempty" json:"privileged,omitempty"`
	PullPolicy          string                           `mapstructure:"pull_policy" yaml:"pull_policy,omitempty" json:"pull_policy,omitempty"`
	ReadOnly            bool                             `mapstructure:"read_only" yaml:"read_only,omitempty" json:"read_only,omitempty"`
	Restart             string                           `yaml:",omitempty" json:"restart,omitempty"`
	Runtime             string                           `yaml:",omitempty" json:"runtime,omitempty"`
	Scale               int                              `yaml:"-" json:"-"`
	Secrets             []ServiceSecretConfig            `yaml:",omitempty" json:"secrets,omitempty"`
	SecurityOpt         []string                         `mapstructure:"security_opt" yaml:"security_opt,omitempty" json:"security_opt,omitempty"`
	ShmSize             UnitBytes                        `mapstructure:"shm_size" yaml:"shm_size,omitempty" json:"shm_size,omitempty"`
	StdinOpen           bool                             `mapstructure:"stdin_open" yaml:"stdin_open,omitempty" json:"stdin_open,omitempty"`
	StopGracePeriod     *Duration                        `mapstructure:"stop_grace_period" yaml:"stop_grace_period,omitempty" json:"stop_grace_period,omitempty"`
	StopSignal          string                           `mapstructure:"stop_signal" yaml:"stop_signal,omitempty" json:"stop_signal,omitempty"`
	Sysctls             Mapping                          `yaml:",omitempty" json:"sysctls,omitempty"`
	Tmpfs               StringList                       `yaml:",omitempty" json:"tmpfs,omitempty"`
	Tty                 bool                             `mapstructure:"tty" yaml:"tty,omitempty" json:"tty,omitempty"`
	Ulimits             map[string]*UlimitsConfig        `yaml:",omitempty" json:"ulimits,omitempty"`
	User                string                           `yaml:",omitempty" json:"user,omitempty"`
	UserNSMode          string                           `mapstructure:"userns_mode" yaml:"userns_mode,omitempty" json:"userns_mode,omitempty"`
	Uts                 string                           `yaml:"uts,omitempty" json:"uts,omitempty"`
	VolumeDriver        string                           `mapstructure:"volume_driver" yaml:"volume_driver,omitempty" json:"volume_driver,omitempty"`
	Volumes             []ServiceVolumeConfig            `yaml:",omitempty" json:"volumes,omitempty"`
	VolumesFrom         []string                         `mapstructure:"volumes_from" yaml:"volumes_from,omitempty" json:"volumes_from,omitempty"`
	WorkingDir          string                           `mapstructure:"working_dir" yaml:"working_dir,omitempty" json:"working_dir,omitempty"`
	DependsStart        *string                          `yaml:",omitempty" json:"DependsStart,omitempty"`
	Extensions          map[string]interface{}           `yaml:",inline" json:"-"`
}

ServiceConfig is the configuration of one service

func (ServiceConfig) GetDependencies added in v1.0.2

func (s ServiceConfig) GetDependencies() []string

GetDependencies retrieve all services this service depends on

func (ServiceConfig) HasProfile

func (s ServiceConfig) HasProfile(profiles []string) bool

HasProfile return true if service has no profile declared or has at least one profile matching

func (*ServiceConfig) NetworksByPriority

func (s *ServiceConfig) NetworksByPriority() []string

map[string]ServiceConfig NetworksByPriority return the service networks IDs sorted according to Priority

type ServiceConfigObjConfig

type ServiceConfigObjConfig FileReferenceConfig

ServiceConfigObjConfig is the config obj configuration for a service

type ServiceDependency

type ServiceDependency struct {
	Condition  string                 `yaml:",omitempty" json:"condition,omitempty"`
	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

type ServiceFunc

type ServiceFunc func(service ServiceConfig) error

type ServiceNetworkConfig

type ServiceNetworkConfig struct {
	Priority    int      `yaml:",omitempty" json:"priotirt,omitempty"`
	Aliases     []string `yaml:",omitempty" json:"aliases,omitempty"`
	Ipv4Address string   `mapstructure:"ipv4_address" yaml:"ipv4_address,omitempty" json:"ipv4_address,omitempty"`
	Ipv6Address string   `mapstructure:"ipv6_address" yaml:"ipv6_address,omitempty" json:"ipv6_address,omitempty"`

	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

ServiceNetworkConfig is the network configuration for a service

type ServicePortConfig

type ServicePortConfig struct {
	Mode      string `yaml:",omitempty" json:"mode,omitempty"`
	HostIP    string `mapstructure:"host_ip" yaml:"host_ip,omitempty" json:"host_ip,omitempty"`
	Target    uint32 `yaml:",omitempty" json:"target,omitempty"`
	Published uint32 `yaml:",omitempty" json:"published,omitempty"`
	Protocol  string `yaml:",omitempty" json:"protocol,omitempty"`

	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

ServicePortConfig is the port configuration for a service

func ParsePortConfig

func ParsePortConfig(value string) ([]ServicePortConfig, error)

ParsePortConfig parse short syntax for service port configuration

type ServiceSecretConfig

type ServiceSecretConfig FileReferenceConfig

ServiceSecretConfig is the secret configuration for a service

type ServiceVolumeBind

type ServiceVolumeBind struct {
	Propagation    string `yaml:",omitempty" json:"propagation,omitempty"`
	CreateHostPath bool   `mapstructure:"create_host_path" yaml:"create_host_path,omitempty" json:"create_host_path,omitempty"`

	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

ServiceVolumeBind are options for a service volume of type bind

type ServiceVolumeConfig

type ServiceVolumeConfig struct {
	Type        string               `yaml:",omitempty" json:"type,omitempty"`
	Source      string               `yaml:",omitempty" json:"source,omitempty"`
	Target      string               `yaml:",omitempty" json:"target,omitempty"`
	ReadOnly    bool                 `mapstructure:"read_only" yaml:"read_only,omitempty" json:"read_only,omitempty"`
	Consistency string               `yaml:",omitempty" json:"consistency,omitempty"`
	Bind        *ServiceVolumeBind   `yaml:",omitempty" json:"bind,omitempty"`
	Volume      *ServiceVolumeVolume `yaml:",omitempty" json:"volume,omitempty"`
	Tmpfs       *ServiceVolumeTmpfs  `yaml:",omitempty" json:"tmpfs,omitempty"`

	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

ServiceVolumeConfig are references to a volume used by a service

type ServiceVolumeTmpfs

type ServiceVolumeTmpfs struct {
	Size UnitBytes `yaml:",omitempty" json:"size,omitempty"`

	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

ServiceVolumeTmpfs are options for a service volume of type tmpfs

type ServiceVolumeVolume

type ServiceVolumeVolume struct {
	NoCopy bool `mapstructure:"nocopy" yaml:"nocopy,omitempty" json:"nocopy,omitempty"`

	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

ServiceVolumeVolume are options for a service volume of type volume

type Services

type Services []ServiceConfig

Services is a list of ServiceConfig

func (Services) GetProfiles

func (s Services) GetProfiles() []string

GetProfiles retrieve the profiles implicitly enabled by explicitly targeting selected services

func (Services) MarshalJSON

func (s Services) MarshalJSON() ([]byte, error)

MarshalJSON makes Services implement json.Marshaler

func (Services) MarshalYAML

func (s Services) MarshalYAML() (interface{}, error)

MarshalYAML makes Services implement yaml.Marshaller

type ShellCommand

type ShellCommand []string

ShellCommand is a string or list of string args

type StringList

type StringList []string

StringList is a type for fields that can be a string or list of strings

type StringOrNumberList

type StringOrNumberList []string

StringOrNumberList is a type for fields that can be a list of strings or numbers

type ThrottleDevice

type ThrottleDevice struct {
	Path string
	Rate uint64

	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

ThrottleDevice is a structure that holds device:rate_per_second pair

type UlimitsConfig

type UlimitsConfig struct {
	Single int `yaml:",omitempty" json:"single,omitempty"`
	Soft   int `yaml:",omitempty" json:"soft,omitempty"`
	Hard   int `yaml:",omitempty" json:"hard,omitempty"`

	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

UlimitsConfig the ulimit configuration

func (*UlimitsConfig) MarshalJSON

func (u *UlimitsConfig) MarshalJSON() ([]byte, error)

MarshalJSON makes UlimitsConfig implement json.Marshaller

func (*UlimitsConfig) MarshalYAML

func (u *UlimitsConfig) MarshalYAML() (interface{}, error)

MarshalYAML makes UlimitsConfig implement yaml.Marshaller

type UnitBytes

type UnitBytes int64

UnitBytes is the bytes type

func (UnitBytes) MarshalJSON

func (u UnitBytes) MarshalJSON() ([]byte, error)

MarshalJSON makes UnitBytes implement json.Marshaler

func (UnitBytes) MarshalYAML

func (u UnitBytes) MarshalYAML() (interface{}, error)

MarshalYAML makes UnitBytes implement yaml.Marshaller

type VolumeConfig

type VolumeConfig struct {
	Name       string                 `yaml:",omitempty" json:"name,omitempty"`
	Driver     string                 `yaml:",omitempty" json:"driver,omitempty"`
	DriverOpts map[string]string      `mapstructure:"driver_opts" yaml:"driver_opts,omitempty" json:"driver_opts,omitempty"`
	External   External               `yaml:",omitempty" json:"external,omitempty"`
	Labels     Labels                 `yaml:",omitempty" json:"labels,omitempty"`
	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

VolumeConfig for a volume

type Volumes

type Volumes map[string]VolumeConfig

Volumes is a map of VolumeConfig

type WeightDevice

type WeightDevice struct {
	Path   string
	Weight uint16

	Extensions map[string]interface{} `yaml:",inline" json:"-"`
}

WeightDevice is a structure that holds device:weight pair

Jump to

Keyboard shortcuts

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