Fix logs (concurrent access to container.ID, logs was displaying the first container logs for every container)

Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
This commit is contained in:
Guillaume Tardif 2020-11-17 15:13:36 +01:00
parent a701fd7601
commit da99ad40d5
1 changed files with 3 additions and 3 deletions

View File

@ -191,10 +191,11 @@ func (s *local) Logs(ctx context.Context, projectName string, w io.Writer) error
consumer := formatter.NewLogConsumer(w)
for _, c := range list {
service := c.Labels["com.docker.compose.service"]
containerId := c.ID
go func() {
s.containerService.Logs(ctx, c.ID, containers.LogsRequest{
s.containerService.Logs(ctx,containerId, containers.LogsRequest{
Follow: true,
Writer: consumer.GetWriter(service, c.ID),
Writer: consumer.GetWriter(service, containerId),
})
wg.Done()
}()
@ -534,7 +535,6 @@ func (s *local) ensureNetwork(ctx context.Context, n types.NetworkConfig) error
return nil
}
func (s *local) ensureVolume(ctx context.Context, volume types.VolumeConfig) error {
// TODO could identify volume by label vs name
_, err := s.volumeService.Inspect(ctx, volume.Name)