Skip to content

Commit

Permalink
display creation warnings from the engine
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
  • Loading branch information
glours committed Nov 15, 2022
1 parent c53539e commit a077e8a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pkg/compose/convergence.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ func (s *composeService) createContainer(ctx context.Context, project *types.Pro
w := progress.ContextWriter(ctx)
eventName := "Container " + name
w.Event(progress.CreatingEvent(eventName))
container, err = s.createMobyContainer(ctx, project, service, name, number, nil, autoRemove, useNetworkAliases, attachStdin)
container, err = s.createMobyContainer(ctx, project, service, name, number, nil, autoRemove, useNetworkAliases, attachStdin, w)
if err != nil {
return
}
Expand Down Expand Up @@ -437,7 +437,7 @@ func (s *composeService) recreateContainer(ctx context.Context, project *types.P
inherited = &replaced
}
name = getContainerName(project.Name, service, number)
created, err = s.createMobyContainer(ctx, project, service, name, number, inherited, false, true, false)
created, err = s.createMobyContainer(ctx, project, service, name, number, inherited, false, true, false, w)
if err != nil {
return created, err
}
Expand Down Expand Up @@ -475,7 +475,7 @@ func (s *composeService) startContainer(ctx context.Context, container moby.Cont
}

func (s *composeService) createMobyContainer(ctx context.Context, project *types.Project, service types.ServiceConfig,
name string, number int, inherit *moby.Container, autoRemove bool, useNetworkAliases bool, attachStdin bool) (moby.Container, error) {
name string, number int, inherit *moby.Container, autoRemove bool, useNetworkAliases bool, attachStdin bool, w progress.Writer) (moby.Container, error) {
var created moby.Container
containerConfig, hostConfig, networkingConfig, err := s.getCreateOptions(ctx, project, service, number, inherit, autoRemove, attachStdin)
if err != nil {
Expand All @@ -494,6 +494,13 @@ func (s *composeService) createMobyContainer(ctx context.Context, project *types
if err != nil {
return created, err
}
for _, warning := range response.Warnings {
w.Event(progress.Event{
ID: service.Name,
Status: progress.Warning,
Text: warning,
})
}
inspectedContainer, err := s.apiClient().ContainerInspect(ctx, response.ID)
if err != nil {
return created, err
Expand Down

0 comments on commit a077e8a

Please sign in to comment.