dockercompose

package
v0.0.0-...-13057ba Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Build

type Build struct {
	Context    string
	Dockerfile string
}

Build represents 'build' directive in docker-compose file

func (*Build) Render

func (b *Build) Render() string

Render formats Build as YAML string

type Config

type Config struct {
	Version  string
	Services []*Service
	Networks Networks
	Volumes  NamedVolumes
}

Config represents docker-compose file as a struct

func (*Config) Render

func (c *Config) Render() string

Render formats Config as YAML string

type Environment

type Environment map[string]string

Environment represents 'environment' directive in docker-compose file

func (Environment) Render

func (e Environment) Render() string

Render formats Environment as YAML string

type Image

type Image struct {
	Name string
	Tag  string
}

Image represents 'image' directive in docker-compose file

func (*Image) Render

func (i *Image) Render() string

Render formats Image as YAML string

type NamedVolume

type NamedVolume struct {
	Name   string
	Driver VolumeDriver
}

NamedVolume represents top-level volume in docker-compose file

func (*NamedVolume) Render

func (v *NamedVolume) Render() string

Render formats NamedVolume as YAML string

func (*NamedVolume) ToServiceVolume

func (v *NamedVolume) ToServiceVolume() *ServiceVolume

ToServiceVolume transforms NamedVolume to ServiceVolume

type NamedVolumes

type NamedVolumes []*NamedVolume

NamedVolumes represents top-level 'volumes' directive in docker-compose file

func (NamedVolumes) IsEmpty

func (v NamedVolumes) IsEmpty() bool

IsEmpty checks if NamedVolumes has zero volumes

func (NamedVolumes) Render

func (v NamedVolumes) Render() string

Render formats NamedVolumes as YAML string

func (NamedVolumes) ToServiceVolumes

func (v NamedVolumes) ToServiceVolumes() ServiceVolumes

ToServiceVolumes transforms NamedVolumes to ServiceVolumes

type NestingLevel

type NestingLevel int

NestingLevel represents how deep string to which it is applied should be nested

func (NestingLevel) ApplyTo

func (n NestingLevel) ApplyTo(str string) string

ApplyTo adds spaces (based on the NestingLevel) to the left of the string

type Network

type Network struct {
	Name   string
	Driver NetworkDriver
}

Network is a top-level network in docker-compose file

func (*Network) Render

func (n *Network) Render() string

Render formats Network as YAML string

type NetworkDriver

type NetworkDriver string

NetworkDriver is one of the network drivers supported by docker

const (
	NetworkDriverBridge  NetworkDriver = "bridge"
	NetworkDriverHost    NetworkDriver = "host"
	NetworkDriverOverlay NetworkDriver = "overlay"
	NetworkDriverMacvlan NetworkDriver = "macvlan"
	NetworkDriverNone    NetworkDriver = "none"
)

All supported network drivers

type Networks

type Networks []*Network

Networks is a top-level networks directive

func (Networks) IsEmpty

func (n Networks) IsEmpty() bool

IsEmpty checks if Networks has zero networks

func (Networks) Render

func (n Networks) Render() string

Render formats Networks as YAML string

func (Networks) ToServiceNetworks

func (n Networks) ToServiceNetworks() ServiceNetworks

ToServiceNetworks transforms top-level Networks to service-level ServiceNetworks

type Ports

type Ports []*PortsMapping

Ports represents 'ports' directive in docker-compose file

func (Ports) Render

func (p Ports) Render() string

Render formats Ports as YAML string

type PortsMapping

type PortsMapping struct {
	Host      int
	Container int
}

PortsMapping represents a single mapping of host port to container port

func (*PortsMapping) Render

func (m *PortsMapping) Render() string

Render formats PortsMapping as YAML string

type RestartPolicy

type RestartPolicy string

RestartPolicy is one of the restart policies supported by docker

const (
	RestartPolicyNo            RestartPolicy = "no"
	RestartPolicyAlways        RestartPolicy = "always"
	RestartPolicyOnFailure     RestartPolicy = "on-failure"
	RestartPolicyUnlessStopped RestartPolicy = "unless-stopped"
)

All supported restart policies

func (RestartPolicy) Render

func (r RestartPolicy) Render() string

Render formats RestartPolicy as YAML string

type Service

type Service struct {
	Name          string
	Build         *Build
	Image         *Image
	ContainerName string
	WorkingDir    string
	Restart       RestartPolicy
	Ports         Ports
	Environment   Environment
	Networks      ServiceNetworks
	Volumes       ServiceVolumes
}

Service represents a single service inside docker-compose services directive

func (*Service) Render

func (s *Service) Render() string

Render formats Service as YAML string

type ServiceNetworks

type ServiceNetworks []*Network

ServiceNetworks is service-level networks

func (ServiceNetworks) Render

func (n ServiceNetworks) Render() string

Render formats ServiceNetworks as YAML string

type ServiceVolume

type ServiceVolume struct {
	Source string
	Target string
}

ServiceVolume represents service-level volume mapping in docker-compose file

func (*ServiceVolume) String

func (v *ServiceVolume) String() string

String formats ServiceVolume as a mapping

type ServiceVolumes

type ServiceVolumes []*ServiceVolume

ServiceVolumes represents service-level volumes directive

func (ServiceVolumes) Render

func (v ServiceVolumes) Render() string

Render formats ServiceVolumes as YAML string

type VolumeDriver

type VolumeDriver string

VolumeDriver is one of the volume drivers supported by docker

const (
	VolumeDriverLocal VolumeDriver = "local"
)

All supported volume drivers

Jump to

Keyboard shortcuts

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