@@ -26,6 +26,8 @@ const (
26
26
labelClone = "dblab_clone"
27
27
)
28
28
29
+ var systemVolumes = []string {"/sys" , "/lib" , "/proc" }
30
+
29
31
// RunContainer runs specified container.
30
32
func RunContainer (r runners.Runner , c * resources.AppConfig ) (string , error ) {
31
33
hostInfo , err := host .Info ()
@@ -94,6 +96,11 @@ func buildMountVolumes(r runners.Runner, c *resources.AppConfig, containerID str
94
96
volumes := make ([]string , 0 , len (mounts ))
95
97
96
98
for _ , mountPoint := range mountPoints {
99
+ // Exclude system volumes from a clone container.
100
+ if isSystemVolume (mountPoint .Source ) {
101
+ continue
102
+ }
103
+
97
104
// Add extra mount for socket directories.
98
105
if strings .HasPrefix (unixSocketCloneDir , mountPoint .Destination ) {
99
106
volumes = append (volumes , buildSocketMount (unixSocketCloneDir , mountPoint .Source , mountPoint .Destination ))
@@ -114,6 +121,16 @@ func buildMountVolumes(r runners.Runner, c *resources.AppConfig, containerID str
114
121
return volumes , nil
115
122
}
116
123
124
+ func isSystemVolume (source string ) bool {
125
+ for _ , sysVolume := range systemVolumes {
126
+ if strings .HasPrefix (source , sysVolume ) {
127
+ return true
128
+ }
129
+ }
130
+
131
+ return false
132
+ }
133
+
117
134
// buildSocketMount builds a socket directory mounting rely on dataDir mounting.
118
135
func buildSocketMount (socketDir , hostDataDir , destinationDir string ) string {
119
136
socketPath := strings .TrimPrefix (socketDir , destinationDir )
0 commit comments