github.com/docker/libcompose@v0.4.1-0.20210616120443-2a046c0bdbf2/project/project_up.go (about)

     1  package project
     2  
     3  import (
     4  	"golang.org/x/net/context"
     5  
     6  	"github.com/docker/libcompose/project/events"
     7  	"github.com/docker/libcompose/project/options"
     8  )
     9  
    10  // Up creates and starts the specified services (kinda like docker run).
    11  func (p *Project) Up(ctx context.Context, options options.Up, services ...string) error {
    12  	if err := p.initialize(ctx); err != nil {
    13  		return err
    14  	}
    15  	return p.perform(events.ProjectUpStart, events.ProjectUpDone, services, wrapperAction(func(wrapper *serviceWrapper, wrappers map[string]*serviceWrapper) {
    16  		wrapper.Do(wrappers, events.ServiceUpStart, events.ServiceUp, func(service Service) error {
    17  			return service.Up(ctx, options)
    18  		})
    19  	}), func(service Service) error {
    20  		return service.Create(ctx, options.Create)
    21  	})
    22  }