summaryrefslogtreecommitdiff
path: root/daemon/volumes_linux.go
diff options
context:
space:
mode:
authorJohn Howard <jhoward@microsoft.com>2015-04-29 15:53:35 -0700
committerJohn Howard <jhoward@microsoft.com>2015-05-16 12:38:20 -0700
commitb9e4b95788e0d8eae5363b82f301dafb9ea687f7 (patch)
tree3bc5cd92d5ede705c63016b00e8ed529883ff258 /daemon/volumes_linux.go
parenta9172f572e13086859c652e2d581950e910d63d4 (diff)
downloaddocker-b9e4b95788e0d8eae5363b82f301dafb9ea687f7.tar.gz
Windows: Refactor container
Signed-off-by: John Howard <jhoward@microsoft.com>
Diffstat (limited to 'daemon/volumes_linux.go')
-rw-r--r--daemon/volumes_linux.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/daemon/volumes_linux.go b/daemon/volumes_linux.go
index 93fea81659..8bb7b8d841 100644
--- a/daemon/volumes_linux.go
+++ b/daemon/volumes_linux.go
@@ -5,6 +5,7 @@ package daemon
import (
"os"
+ "github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/pkg/system"
)
@@ -22,3 +23,37 @@ func copyOwnership(source, destination string) error {
return os.Chmod(destination, os.FileMode(stat.Mode()))
}
+
+func (container *Container) prepareVolumes() error {
+ if container.Volumes == nil || len(container.Volumes) == 0 {
+ container.Volumes = make(map[string]string)
+ container.VolumesRW = make(map[string]bool)
+ }
+
+ if len(container.hostConfig.VolumesFrom) > 0 && container.AppliedVolumesFrom == nil {
+ container.AppliedVolumesFrom = make(map[string]struct{})
+ }
+ return container.createVolumes()
+}
+
+func (container *Container) setupMounts() error {
+ 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],
+ })
+ }
+
+ mounts = append(mounts, container.specialMounts()...)
+
+ container.command.Mounts = mounts
+ return nil
+}