libcompose: Index | Files

package service

import ""


Package Files

convert.go name.go service.go service_create.go service_factory.go utils.go

func Convert Uses

func Convert(c *config.ServiceConfig, ctx project.Context, clientFactory composeclient.Factory) (*container.Config, *container.HostConfig, error)

Convert converts a service configuration to an docker API structures (Config and HostConfig)

func DefaultDependentServices Uses

func DefaultDependentServices(p *project.Project, s project.Service) []project.ServiceRelationship

DefaultDependentServices return the dependent services (as an array of ServiceRelationship) for the specified project and service. It looks for : links, volumesFrom, net and ipc configuration. It uses default project implementation and append some docker specific ones.

func Filter Uses

func Filter(vs []string, f func(string) bool) []string

Filter filters the specified string slice with the specified function.

func GetContainerFromIpcLikeConfig Uses

func GetContainerFromIpcLikeConfig(p *project.Project, conf string) string

GetContainerFromIpcLikeConfig returns name of the service that shares the IPC namespace with the specified service.

type ConfigWrapper Uses

type ConfigWrapper struct {
    Config           *container.Config
    HostConfig       *container.HostConfig
    NetworkingConfig *network.NetworkingConfig

ConfigWrapper wraps Config, HostConfig and NetworkingConfig for a container.

func ConvertToAPI Uses

func ConvertToAPI(serviceConfig *config.ServiceConfig, ctx project.Context, clientFactory composeclient.Factory) (*ConfigWrapper, error)

ConvertToAPI converts a service configuration to a docker API container configuration.

type Factory Uses

type Factory struct {
    // contains filtered or unexported fields

Factory is an implementation of project.ServiceFactory.

func NewFactory Uses

func NewFactory(context *ctx.Context) *Factory

NewFactory creates a new service factory for the given context

func (*Factory) Create Uses

func (s *Factory) Create(project *project.Project, name string, serviceConfig *config.ServiceConfig) (project.Service, error)

Create creates a Service based on the specified project, name and service configuration.

type Namer Uses

type Namer interface {
    Next() (string, int)

Namer defines method to provide container name.

func NewNamer Uses

func NewNamer(ctx context.Context, client client.ContainerAPIClient, project, service string, oneOff bool) (Namer, error)

NewNamer returns a namer that returns names based on the specified project and service name and an inner counter, e.g. project_service_1, project_service_2…

func NewSingleNamer Uses

func NewSingleNamer(name string) Namer

NewSingleNamer returns a namer that only allows a single name.

type Service Uses

type Service struct {
    // contains filtered or unexported fields

Service is a project.Service implementations.

func NewService Uses

func NewService(name string, serviceConfig *config.ServiceConfig, context *ctx.Context) *Service

NewService creates a service

func (*Service) Build Uses

func (s *Service) Build(ctx context.Context, buildOptions options.Build) error

Build implements Service.Build. It will try to build the image and returns an error if any.

func (*Service) Config Uses

func (s *Service) Config() *config.ServiceConfig

Config returns the configuration of the service (config.ServiceConfig).

func (*Service) Containers Uses

func (s *Service) Containers(ctx context.Context) ([]project.Container, error)

Containers implements Service.Containers. It returns the list of containers that are related to the service.

func (*Service) Create Uses

func (s *Service) Create(ctx context.Context, options options.Create) error

Create implements Service.Create. It ensures the image exists or build it if it can and then create a container.

func (*Service) Delete Uses

func (s *Service) Delete(ctx context.Context, options options.Delete) error

Delete implements Service.Delete. It removes any containers related to the service.

func (*Service) DependentServices Uses

func (s *Service) DependentServices() []project.ServiceRelationship

DependentServices returns the dependent services (as an array of ServiceRelationship) of the service.

func (*Service) Events Uses

func (s *Service) Events(ctx context.Context, evts chan events.ContainerEvent) error

Events implements Service.Events. It listen to all real-time events happening for the service, and put them into the specified chan.

func (*Service) Info Uses

func (s *Service) Info(ctx context.Context) (project.InfoSet, error)

Info implements Service.Info. It returns an project.InfoSet with the containers related to this service (can be multiple if using the scale command).

func (*Service) Kill Uses

func (s *Service) Kill(ctx context.Context, signal string) error

Kill implements Service.Kill. It kills any containers related to the service.

func (*Service) Log Uses

func (s *Service) Log(ctx context.Context, follow bool) error

Log implements Service.Log. It returns the docker logs for each container related to the service.

func (*Service) Name Uses

func (s *Service) Name() string

Name returns the service name.

func (*Service) NetworkConnect Uses

func (s *Service) NetworkConnect(ctx context.Context, c *container.Container, net *yaml.Network, oneOff bool) error

NetworkConnect connects the container to the specified network FIXME(vdemeester) will be refactor with Container refactoring

func (*Service) NetworkDisconnect Uses

func (s *Service) NetworkDisconnect(ctx context.Context, c *container.Container, net *yaml.Network, oneOff bool) error

NetworkDisconnect disconnects the container from the specified network

func (*Service) OutOfSync Uses

func (s *Service) OutOfSync(ctx context.Context, c *container.Container) (bool, error)

OutOfSync checks if the container is out of sync with the service definition. It looks if the the service hash container label is the same as the computed one.

func (*Service) Pause Uses

func (s *Service) Pause(ctx context.Context) error

Pause implements Service.Pause. It puts into pause the container(s) related to the service.

func (*Service) Pull Uses

func (s *Service) Pull(ctx context.Context) error

Pull implements Service.Pull. It pulls the image of the service and skip the service that would need to be built.

func (*Service) RemoveImage Uses

func (s *Service) RemoveImage(ctx context.Context, imageType options.ImageType) error

RemoveImage implements Service.RemoveImage. It removes images used for the service depending on the specified type.

func (*Service) Restart Uses

func (s *Service) Restart(ctx context.Context, timeout int) error

Restart implements Service.Restart. It restarts any containers related to the service.

func (*Service) Run Uses

func (s *Service) Run(ctx context.Context, commandParts []string, options options.Run) (int, error)

Run implements Service.Run. It runs a one of command within the service container. It always create a new container.

func (*Service) Scale Uses

func (s *Service) Scale(ctx context.Context, scale int, timeout int) error

Scale implements Service.Scale. It creates or removes containers to have the specified number of related container to the service to run.

func (*Service) Start Uses

func (s *Service) Start(ctx context.Context) error

Start implements Service.Start. It tries to start a container without creating it.

func (*Service) Stop Uses

func (s *Service) Stop(ctx context.Context, timeout int) error

Stop implements Service.Stop. It stops any containers related to the service.

func (*Service) Unpause Uses

func (s *Service) Unpause(ctx context.Context) error

Unpause implements Service.Pause. It brings back from pause the container(s) related to the service.

func (*Service) Up Uses

func (s *Service) Up(ctx context.Context, options options.Up) error

Up implements Service.Up. It builds the image if needed, creates a container and start it.

Package service imports 28 packages (graph) and is imported by 6 packages. Updated 2018-05-06. Refresh now. Tools for package owners.