|
@@ -316,8 +316,23 @@ func validMountMode(mode string) bool {
|
|
|
}
|
|
|
|
|
|
func (container *Container) setupMounts() error {
|
|
|
- mounts := []execdriver.Mount{
|
|
|
- {Source: container.ResolvConfPath, Destination: "/etc/resolv.conf", Writable: true, Private: true},
|
|
|
+ mounts := []execdriver.Mount{}
|
|
|
+
|
|
|
+ // Mount user specified volumes
|
|
|
+ // Note, these are not private because you may want propagation of (un)mounts from host
|
|
|
+ // volumes. For instance if you use -v /usr:/usr and the host later mounts /usr/share you
|
|
|
+ // want this new mount in the container
|
|
|
+ // These mounts must be ordered based on the length of the path that it is being mounted to (lexicographic)
|
|
|
+ for _, path := range container.sortedVolumeMounts() {
|
|
|
+ mounts = append(mounts, execdriver.Mount{
|
|
|
+ Source: container.Volumes[path],
|
|
|
+ Destination: path,
|
|
|
+ Writable: container.VolumesRW[path],
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ if container.ResolvConfPath != "" {
|
|
|
+ mounts = append(mounts, execdriver.Mount{Source: container.ResolvConfPath, Destination: "/etc/resolv.conf", Writable: true, Private: true})
|
|
|
}
|
|
|
|
|
|
if container.HostnamePath != "" {
|
|
@@ -334,19 +349,6 @@ func (container *Container) setupMounts() error {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // Mount user specified volumes
|
|
|
- // Note, these are not private because you may want propagation of (un)mounts from host
|
|
|
- // volumes. For instance if you use -v /usr:/usr and the host later mounts /usr/share you
|
|
|
- // want this new mount in the container
|
|
|
- // These mounts must be ordered based on the length of the path that it is being mounted to (lexicographic)
|
|
|
- for _, path := range container.sortedVolumeMounts() {
|
|
|
- mounts = append(mounts, execdriver.Mount{
|
|
|
- Source: container.Volumes[path],
|
|
|
- Destination: path,
|
|
|
- Writable: container.VolumesRW[path],
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
container.command.Mounts = mounts
|
|
|
return nil
|
|
|
}
|