Ensure images are pulled/build with build first, before creating networks / volumes and starting containers.

Will also avoid mixing build output and compose-cli progress display

Signed-off-by: Guillame Tardif <guillaume.tardif@gmail.com>
This commit is contained in:
Guillame Tardif 2020-11-27 13:46:57 +01:00
parent c0805464f5
commit bc9099de9b
1 changed files with 4 additions and 5 deletions

View File

@ -54,6 +54,10 @@ type composeService struct {
}
func (s *composeService) Up(ctx context.Context, project *types.Project, detach bool) error {
err := s.ensureImagesExists(ctx, project)
if err != nil {
return err
}
for k, network := range project.Networks {
if !network.External.External && network.Name != "" {
network.Name = fmt.Sprintf("%s_%s", project.Name, k)
@ -82,11 +86,6 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, detach
}
}
err := s.ensureImagesExists(ctx, project)
if err != nil {
return err
}
err = inDependencyOrder(ctx, project, func(c context.Context, service types.ServiceConfig) error {
return s.ensureService(c, project, service)
})