@@ -79,15 +79,18 @@ func buildMountVolumes(r runners.Runner, c *resources.AppConfig, containerID str
79
79
return nil , errors .Wrap (err , "failed to interpret mount paths" )
80
80
}
81
81
82
- mounts := tools .GetMountsFromMountPoints (c .MountDir , c . DataDir (), mountPoints )
82
+ mounts := tools .GetMountsFromMountPoints (c .DataDir (), mountPoints )
83
83
volumes := make ([]string , 0 , len (mounts ))
84
84
85
- for _ , mount := range mounts {
85
+ for _ , mountPoint := range mountPoints {
86
86
// Add extra mount for socket directories.
87
- if mount .Target == c .DataDir () && strings .HasPrefix (c .UnixSocketCloneDir , c .MountDir ) {
88
- volumes = append (volumes , buildSocketMount (c , mount .Source ))
87
+ if strings .HasPrefix (c .UnixSocketCloneDir , mountPoint .Destination ) {
88
+ volumes = append (volumes , buildSocketMount (c .UnixSocketCloneDir , mountPoint .Source , mountPoint .Destination ))
89
+ break
89
90
}
91
+ }
90
92
93
+ for _ , mount := range mounts {
91
94
volume := fmt .Sprintf ("--volume %s:%s" , mount .Source , mount .Target )
92
95
93
96
if mount .BindOptions != nil && mount .BindOptions .Propagation != "" {
@@ -101,13 +104,11 @@ func buildMountVolumes(r runners.Runner, c *resources.AppConfig, containerID str
101
104
}
102
105
103
106
// buildSocketMount builds a socket directory mounting rely on dataDir mounting.
104
- func buildSocketMount (c * resources.AppConfig , hostDataDir string ) string {
105
- socketPath := strings .TrimPrefix (c .UnixSocketCloneDir , c .MountDir )
106
- dataPath := strings .TrimPrefix (c .DataDir (), c .MountDir )
107
- externalMount := strings .TrimSuffix (hostDataDir , dataPath )
108
- hostSocketDir := path .Join (externalMount , socketPath )
107
+ func buildSocketMount (socketDir , hostDataDir , destinationDir string ) string {
108
+ socketPath := strings .TrimPrefix (socketDir , destinationDir )
109
+ hostSocketDir := path .Join (hostDataDir , socketPath )
109
110
110
- return fmt .Sprintf (" --volume %s:%s:rshared" , hostSocketDir , c . UnixSocketCloneDir )
111
+ return fmt .Sprintf (" --volume %s:%s:rshared" , hostSocketDir , socketDir )
111
112
}
112
113
113
114
func createSocketCloneDir (socketCloneDir string ) error {
0 commit comments