@@ -260,7 +260,7 @@ func (s *composeService) getCreateOptions(ctx context.Context, p *types.Project,
260
260
stdinOpen = service .StdinOpen
261
261
)
262
262
263
- volumeMounts , binds , mounts , err := s .buildContainerVolumes (ctx , * p , service , inherit )
263
+ binds , mounts , err := s .buildContainerVolumes (ctx , * p , service , inherit )
264
264
if err != nil {
265
265
return nil , nil , nil , err
266
266
}
@@ -289,7 +289,6 @@ func (s *composeService) getCreateOptions(ctx context.Context, p *types.Project,
289
289
StopSignal : service .StopSignal ,
290
290
Env : ToMobyEnv (env ),
291
291
Healthcheck : ToMobyHealthCheck (service .HealthCheck ),
292
- Volumes : volumeMounts ,
293
292
StopTimeout : ToSeconds (service .StopGracePeriod ),
294
293
}
295
294
@@ -731,30 +730,32 @@ func getDependentServiceFromMode(mode string) string {
731
730
return ""
732
731
}
733
732
734
- func (s * composeService ) buildContainerVolumes (ctx context.Context , p types.Project , service types.ServiceConfig ,
735
- inherit * moby.Container ) (map [string ]struct {}, []string , []mount.Mount , error ) {
736
- var mounts = []mount.Mount {}
733
+ func (s * composeService ) buildContainerVolumes (
734
+ ctx context.Context ,
735
+ p types.Project ,
736
+ service types.ServiceConfig ,
737
+ inherit * moby.Container ,
738
+ ) ([]string , []mount.Mount , error ) {
739
+ var mounts []mount.Mount
740
+ var binds []string
737
741
738
742
image := api .GetImageNameOrDefault (service , p .Name )
739
743
imgInspect , _ , err := s .apiClient ().ImageInspectWithRaw (ctx , image )
740
744
if err != nil {
741
- return nil , nil , nil , err
745
+ return nil , nil , err
742
746
}
743
747
744
748
mountOptions , err := buildContainerMountOptions (p , service , imgInspect , inherit )
745
749
if err != nil {
746
- return nil , nil , nil , err
750
+ return nil , nil , err
747
751
}
748
752
749
- volumeMounts := map [string ]struct {}{}
750
- binds := []string {}
751
753
MOUNTS:
752
754
for _ , m := range mountOptions {
753
755
if m .Type == mount .TypeNamedPipe {
754
756
mounts = append (mounts , m )
755
757
continue
756
758
}
757
- volumeMounts [m .Target ] = struct {}{}
758
759
if m .Type == mount .TypeBind {
759
760
// `Mount` is preferred but does not offer option to created host path if missing
760
761
// so `Bind` API is used here with raw volume string
@@ -774,7 +775,7 @@ MOUNTS:
774
775
}
775
776
mounts = append (mounts , m )
776
777
}
777
- return volumeMounts , binds , mounts , nil
778
+ return binds , mounts , nil
778
779
}
779
780
780
781
func buildContainerMountOptions (p types.Project , s types.ServiceConfig , img moby.ImageInspect , inherit * moby.Container ) ([]mount.Mount , error ) {
0 commit comments