types

package
Version: v0.0.0-...-dc31091 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2020 License: Apache-2.0 Imports: 8 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"
	//PullPolicyBuild force building images
	PullPolicyBuild = "build"
)
View Source
const (
	// TypeBind is the type for mounting host dir
	VolumeTypeBind = "bind"
	// TypeVolume is the type for remote storage volumes
	VolumeTypeVolume = "volume"
	// TypeTmpfs is the type for mounting tmpfs
	VolumeTypeTmpfs = "tmpfs"
	// TypeNamedPipe 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 (
	// TypeServiceConditionHealthy is the type for waiting until a service is
	// healthy.
	ServiceConditionHealthy = "service_healthy"

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

Variables

This section is empty.

Functions

func ConvertDurationPtr

func ConvertDurationPtr(d *Duration) *time.Duration

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

Types

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 using the same format at libcompose: https://github.com/docker/libcompose/blob/master/yaml/build.go#L12

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 map[string]interface{} `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 string
	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 DeployConfig

type DeployConfig struct {
	Mode           string         `yaml:",omitempty" json:"mode,omitempty"`
	Replicas       *uint64        `yaml:",omitempty" json:"replicas,omitempty"`
	Labels         Labels         `yaml:",omitempty" json:"labels,omitempty"`
	UpdateConfig   *UpdateConfig  `mapstructure:"update_config" yaml:"update_config,omitempty" json:"update_config,omitempty"`
	RollbackConfig *UpdateConfig  `mapstructure:"rollback_config" yaml:"rollback_config,omitempty" json:"rollback_config,omitempty"`
	Resources      Resources      `yaml:",omitempty" json:"resources,omitempty"`
	RestartPolicy  *RestartPolicy `mapstructure:"restart_policy" yaml:"restart_policy,omitempty" json:"restart_policy,omitempty"`
	Placement      Placement      `yaml:",omitempty" json:"placement,omitempty"`
	EndpointMode   string         `mapstructure:"endpoint_mode" yaml:"endpoint_mode,omitempty" json:"endpoint_mode,omitempty"`

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

DeployConfig the deployment configuration for a service

type DeviceRequest

type DeviceRequest struct {
	Capabilities []string `mapstructure:"capabilities" yaml:"capabilities,omitempty" json:"capabilities,omitempty"`
	Diver        string   `mapstructure:"driver" yaml:"driver,omitempty" json:"driver,omitempty"`
	Count        int      `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 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 `""`.

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 (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"`
	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 Placement

type Placement struct {
	Constraints []string               `yaml:",omitempty" json:"constraints,omitempty"`
	Preferences []PlacementPreferences `yaml:",omitempty" json:"preferences,omitempty"`
	MaxReplicas uint64                 `mapstructure:"max_replicas_per_node" yaml:"max_replicas_per_node,omitempty" json:"max_replicas_per_node,omitempty"`

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

Placement constraints for the service

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
	WorkingDir   string
	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   map[string]interface{} `yaml:",inline" json:"-"`
	ComposeFiles []string               `yaml:",omitempty" json:"composefiles,omitempty"`
}

Project is the result of loading a set of compose files

func (Project) ConfigNames

func (p Project) ConfigNames() []string

ConfigNames return names for all configs in this Compose config

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) 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

type Resource

type Resource struct {
	// TODO: types to convert from units and ratios
	NanoCPUs         string            `mapstructure:"cpus" yaml:"cpus,omitempty" json:"cpus,omitempty"`
	MemoryBytes      int64             `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 Resources

type Resources struct {
	Limits       *Resource `yaml:",omitempty" json:"limits,omitempty"`
	Reservations *Resource `yaml:",omitempty" json:"reservations,omitempty"`

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

Resources the resource limits and reservations

type RestartPolicy

type RestartPolicy struct {
	Condition   string    `yaml:",omitempty" json:"condition,omitempty"`
	Delay       *Duration `yaml:",omitempty" json:"delay,omitempty"`
	MaxAttempts *uint64   `mapstructure:"max_attempts" yaml:"max_attempts,omitempty" json:"max_attempts,omitempty"`
	Window      *Duration `yaml:",omitempty" json:"window,omitempty"`

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

RestartPolicy the service restart policy

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:"-"`

	Build           *BuildConfig                     `yaml:",omitempty" json:"build,omitempty"`
	BlkioConfig     string                           `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"`
	DependsOn       DependsOnConfig                  `mapstructure:"depends_on" yaml:"depends_on,omitempty" json:"depends_on,omitempty"`
	Deploy          *DeployConfig                    `yaml:",omitempty" json:"deploy,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_app" 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"`
	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        int64                            `mapstructure:"mem_limit" yaml:"mem_limit,omitempty" json:"mem_limit,omitempty"`
	MemReservation  int64                            `mapstructure:"mem_reservation" yaml:"mem_reservation,omitempty" json:"mem_reservation,omitempty"`
	MemSwapLimit    int64                            `mapstructure:"memswap_limit" yaml:"memswap_limit,omitempty" json:"memswap_limit,omitempty"`
	MemSwappiness   int64                            `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"`
	PidLimit        int64                            `mapstructure:"pid_limit" yaml:"pid_limit,omitempty" json:"pid_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                           `yaml:",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:",omitempty" json:"scale,omitempty"`
	Secrets         []ServiceSecretConfig            `yaml:",omitempty" json:"secrets,omitempty"`
	SecurityOpt     []string                         `mapstructure:"security_opt" yaml:"security_opt,omitempty" json:"security_opt,omitempty"`
	ShmSize         string                           `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"`

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

ServiceConfig is the configuration of one service

func (ServiceConfig) GetDependencies

func (s ServiceConfig) GetDependencies() []string

GetDependencies retrieve all services this service depends on

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 {
	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 `yaml:"-" json:"-"`
	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"`

	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 int64 `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) 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 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 UpdateConfig

type UpdateConfig struct {
	Parallelism     *uint64  `yaml:",omitempty" json:"parallelism,omitempty"`
	Delay           Duration `yaml:",omitempty" json:"delay,omitempty"`
	FailureAction   string   `mapstructure:"failure_action" yaml:"failure_action,omitempty" json:"failure_action,omitempty"`
	Monitor         Duration `yaml:",omitempty" json:"monitor,omitempty"`
	MaxFailureRatio float32  `mapstructure:"max_failure_ratio" yaml:"max_failure_ratio,omitempty" json:"max_failure_ratio,omitempty"`
	Order           string   `yaml:",omitempty" json:"order,omitempty"`

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

UpdateConfig the service update configuration

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

Jump to

Keyboard shortcuts

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