@@ -618,9 +618,9 @@ func buildContainerConfigMounts(p types.Project, s types.ServiceConfig) ([]mount
618
618
for _ , config := range s .Configs {
619
619
target := config .Target
620
620
if config .Target == "" {
621
- target = filepath . Join ( configsBaseDir , config .Source )
622
- } else if ! filepath . IsAbs (config .Target ) {
623
- target = filepath . Join ( configsBaseDir , config .Target )
621
+ target = configsBaseDir + config .Source
622
+ } else if ! isUnixAbs (config .Target ) {
623
+ target = configsBaseDir + config .Target
624
624
}
625
625
626
626
definedConfig := p .Configs [config .Source ]
@@ -649,13 +649,13 @@ func buildContainerConfigMounts(p types.Project, s types.ServiceConfig) ([]mount
649
649
func buildContainerSecretMounts (p types.Project , s types.ServiceConfig ) ([]mount.Mount , error ) {
650
650
var mounts = map [string ]mount.Mount {}
651
651
652
- secretsDir := "/run/secrets"
652
+ secretsDir := "/run/secrets/ "
653
653
for _ , secret := range s .Secrets {
654
654
target := secret .Target
655
655
if secret .Target == "" {
656
- target = filepath . Join ( secretsDir , secret .Source )
657
- } else if ! filepath . IsAbs (secret .Target ) {
658
- target = filepath . Join ( secretsDir , secret .Target )
656
+ target = secretsDir + secret .Source
657
+ } else if ! isUnixAbs (secret .Target ) {
658
+ target = secretsDir + secret .Target
659
659
}
660
660
661
661
definedSecret := p .Secrets [secret .Source ]
@@ -681,6 +681,10 @@ func buildContainerSecretMounts(p types.Project, s types.ServiceConfig) ([]mount
681
681
return values , nil
682
682
}
683
683
684
+ func isUnixAbs (path string ) bool {
685
+ return strings .HasPrefix (path , "/" )
686
+ }
687
+
684
688
func buildMount (project types.Project , volume types.ServiceVolumeConfig ) (mount.Mount , error ) {
685
689
source := volume .Source
686
690
if volume .Type == types .VolumeTypeBind && ! filepath .IsAbs (source ) {
@@ -699,7 +703,6 @@ func buildMount(project types.Project, volume types.ServiceVolumeConfig) (mount.
699
703
source = pVolume .Name
700
704
}
701
705
}
702
-
703
706
}
704
707
705
708
return mount.Mount {
0 commit comments