mirror of https://github.com/docker/compose.git
Fix compose volume creation and check this in volume e2e test
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
This commit is contained in:
parent
6aec88e74c
commit
fe363fd146
|
@ -1086,24 +1086,24 @@ func (s *composeService) ensureVolume(ctx context.Context, volume types.VolumeCo
|
|||
// TODO could identify volume by label vs name
|
||||
_, err := s.apiClient.VolumeInspect(ctx, volume.Name)
|
||||
if err != nil {
|
||||
if errdefs.IsNotFound(err) {
|
||||
eventName := fmt.Sprintf("Volume %q", volume.Name)
|
||||
w := progress.ContextWriter(ctx)
|
||||
w.Event(progress.CreatingEvent(eventName))
|
||||
// TODO we miss support for driver_opts and labels
|
||||
_, err := s.apiClient.VolumeCreate(ctx, mobyvolume.VolumeCreateBody{
|
||||
Labels: volume.Labels,
|
||||
Name: volume.Name,
|
||||
Driver: volume.Driver,
|
||||
DriverOpts: volume.DriverOpts,
|
||||
})
|
||||
if err != nil {
|
||||
w.Event(progress.ErrorEvent(eventName))
|
||||
return err
|
||||
}
|
||||
w.Event(progress.CreatedEvent(eventName))
|
||||
if !errdefs.IsNotFound(err) {
|
||||
return err
|
||||
}
|
||||
return err
|
||||
eventName := fmt.Sprintf("Volume %q", volume.Name)
|
||||
w := progress.ContextWriter(ctx)
|
||||
w.Event(progress.CreatingEvent(eventName))
|
||||
// TODO we miss support for driver_opts and labels
|
||||
_, err := s.apiClient.VolumeCreate(ctx, mobyvolume.VolumeCreateBody{
|
||||
Labels: volume.Labels,
|
||||
Name: volume.Name,
|
||||
Driver: volume.Driver,
|
||||
DriverOpts: volume.DriverOpts,
|
||||
})
|
||||
if err != nil {
|
||||
w.Event(progress.ErrorEvent(eventName))
|
||||
return err
|
||||
}
|
||||
w.Event(progress.CreatedEvent(eventName))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -5,3 +5,13 @@ services:
|
|||
- ./static:/usr/share/nginx/html
|
||||
ports:
|
||||
- 8090:80
|
||||
|
||||
nginx2:
|
||||
build: nginx-build
|
||||
volumes:
|
||||
- staticVol:/usr/share/nginx/html
|
||||
ports:
|
||||
- 9090:80
|
||||
|
||||
volumes:
|
||||
staticVol:
|
Loading…
Reference in New Issue