@@ -863,7 +863,7 @@ func buildContainerConfigMounts(p types.Project, s types.ServiceConfig) ([]mount
863863 target := config .Target
864864 if config .Target == "" {
865865 target = configsBaseDir + config .Source
866- } else if ! isUnixAbs (config .Target ) {
866+ } else if ! isAbsTarget (config .Target ) {
867867 target = configsBaseDir + config .Target
868868 }
869869
@@ -898,7 +898,7 @@ func buildContainerSecretMounts(p types.Project, s types.ServiceConfig) ([]mount
898898 target := secret .Target
899899 if secret .Target == "" {
900900 target = secretsDir + secret .Source
901- } else if ! isUnixAbs (secret .Target ) {
901+ } else if ! isAbsTarget (secret .Target ) {
902902 target = secretsDir + secret .Target
903903 }
904904
@@ -929,10 +929,24 @@ func buildContainerSecretMounts(p types.Project, s types.ServiceConfig) ([]mount
929929 return values , nil
930930}
931931
932+ func isAbsTarget (p string ) bool {
933+ return isUnixAbs (p ) || isWindowsAbs (p )
934+ }
935+
932936func isUnixAbs (p string ) bool {
933937 return strings .HasPrefix (p , "/" )
934938}
935939
940+ func isWindowsAbs (p string ) bool {
941+ if strings .HasPrefix (p , "\\ \\ " ) {
942+ return true
943+ }
944+ if len (p ) > 2 && p [1 ] == ':' {
945+ return p [2 ] == '\\'
946+ }
947+ return false
948+ }
949+
936950func buildMount (project types.Project , volume types.ServiceVolumeConfig ) (mount.Mount , error ) {
937951 source := volume .Source
938952 // on windows, filepath.IsAbs(source) is false for unix style abs path like /var/run/docker.sock.
0 commit comments