Signed-off-by: John Howard <jhoward@microsoft.com>
| ... | ... |
@@ -47,6 +47,8 @@ import ( |
| 47 | 47 |
"github.com/docker/docker/registry" |
| 48 | 48 |
"github.com/docker/docker/runconfig" |
| 49 | 49 |
"github.com/docker/docker/trust" |
| 50 |
+ volumedrivers "github.com/docker/docker/volume/drivers" |
|
| 51 |
+ "github.com/docker/docker/volume/local" |
|
| 50 | 52 |
"github.com/docker/libnetwork" |
| 51 | 53 |
"github.com/opencontainers/runc/libcontainer/netlink" |
| 52 | 54 |
) |
| ... | ... |
@@ -1118,3 +1120,12 @@ func (daemon *Daemon) verifyContainerSettings(hostConfig *runconfig.HostConfig, |
| 1118 | 1118 |
// Now do platform-specific verification |
| 1119 | 1119 |
return verifyPlatformContainerSettings(daemon, hostConfig, config) |
| 1120 | 1120 |
} |
| 1121 |
+ |
|
| 1122 |
+func configureVolumes(config *Config) (*volumeStore, error) {
|
|
| 1123 |
+ volumesDriver, err := local.New(config.Root) |
|
| 1124 |
+ if err != nil {
|
|
| 1125 |
+ return nil, err |
|
| 1126 |
+ } |
|
| 1127 |
+ volumedrivers.Register(volumesDriver, volumesDriver.Name()) |
|
| 1128 |
+ return newVolumeStore(volumesDriver.List()), nil |
|
| 1129 |
+} |
| ... | ... |
@@ -21,8 +21,6 @@ import ( |
| 21 | 21 |
"github.com/docker/docker/pkg/system" |
| 22 | 22 |
"github.com/docker/docker/runconfig" |
| 23 | 23 |
"github.com/docker/docker/utils" |
| 24 |
- volumedrivers "github.com/docker/docker/volume/drivers" |
|
| 25 |
- "github.com/docker/docker/volume/local" |
|
| 26 | 24 |
"github.com/docker/libnetwork" |
| 27 | 25 |
nwapi "github.com/docker/libnetwork/api" |
| 28 | 26 |
nwconfig "github.com/docker/libnetwork/config" |
| ... | ... |
@@ -255,15 +253,6 @@ func migrateIfDownlevel(driver graphdriver.Driver, root string) error {
|
| 255 | 255 |
return migrateIfAufs(driver, root) |
| 256 | 256 |
} |
| 257 | 257 |
|
| 258 |
-func configureVolumes(config *Config) (*volumeStore, error) {
|
|
| 259 |
- volumesDriver, err := local.New(config.Root) |
|
| 260 |
- if err != nil {
|
|
| 261 |
- return nil, err |
|
| 262 |
- } |
|
| 263 |
- volumedrivers.Register(volumesDriver, volumesDriver.Name()) |
|
| 264 |
- return newVolumeStore(volumesDriver.List()), nil |
|
| 265 |
-} |
|
| 266 |
- |
|
| 267 | 258 |
func configureSysInit(config *Config) (string, error) {
|
| 268 | 259 |
localCopy := filepath.Join(config.Root, "init", fmt.Sprintf("dockerinit-%s", dockerversion.VERSION))
|
| 269 | 260 |
sysInitPath := utils.DockerInitPath(localCopy) |
| ... | ... |
@@ -75,11 +75,6 @@ func migrateIfDownlevel(driver graphdriver.Driver, root string) error {
|
| 75 | 75 |
return nil |
| 76 | 76 |
} |
| 77 | 77 |
|
| 78 |
-func configureVolumes(config *Config) (*volumeStore, error) {
|
|
| 79 |
- // Windows does not support volumes at this time |
|
| 80 |
- return &volumeStore{}, nil
|
|
| 81 |
-} |
|
| 82 |
- |
|
| 83 | 78 |
func configureSysInit(config *Config) (string, error) {
|
| 84 | 79 |
// TODO Windows. |
| 85 | 80 |
return os.Getenv("TEMP"), nil
|
| ... | ... |
@@ -9,7 +9,6 @@ import ( |
| 9 | 9 |
"io/ioutil" |
| 10 | 10 |
"os" |
| 11 | 11 |
"path/filepath" |
| 12 |
- "strings" |
|
| 13 | 12 |
"sync" |
| 14 | 13 |
|
| 15 | 14 |
"github.com/docker/docker/volume" |
| ... | ... |
@@ -23,11 +22,8 @@ const ( |
| 23 | 23 |
volumesPathName = "volumes" |
| 24 | 24 |
) |
| 25 | 25 |
|
| 26 |
-var ( |
|
| 27 |
- // ErrNotFound is the typed error returned when the requested volume name can't be found |
|
| 28 |
- ErrNotFound = errors.New("volume not found")
|
|
| 29 |
- oldVfsDir = filepath.Join("vfs", "dir")
|
|
| 30 |
-) |
|
| 26 |
+// ErrNotFound is the typed error returned when the requested volume name can't be found |
|
| 27 |
+var ErrNotFound = errors.New("volume not found")
|
|
| 31 | 28 |
|
| 32 | 29 |
// New instantiates a new Root instance with the provided scope. Scope |
| 33 | 30 |
// is the base path that the Root instance uses to store its |
| ... | ... |
@@ -173,22 +169,6 @@ func (r *Root) Get(name string) (volume.Volume, error) {
|
| 173 | 173 |
return v, nil |
| 174 | 174 |
} |
| 175 | 175 |
|
| 176 |
-// scopedPath verifies that the path where the volume is located |
|
| 177 |
-// is under Docker's root and the valid local paths. |
|
| 178 |
-func (r *Root) scopedPath(realPath string) bool {
|
|
| 179 |
- // Volumes path for Docker version >= 1.7 |
|
| 180 |
- if strings.HasPrefix(realPath, filepath.Join(r.scope, volumesPathName)) && realPath != filepath.Join(r.scope, volumesPathName) {
|
|
| 181 |
- return true |
|
| 182 |
- } |
|
| 183 |
- |
|
| 184 |
- // Volumes path for Docker version < 1.7 |
|
| 185 |
- if strings.HasPrefix(realPath, filepath.Join(r.scope, oldVfsDir)) {
|
|
| 186 |
- return true |
|
| 187 |
- } |
|
| 188 |
- |
|
| 189 |
- return false |
|
| 190 |
-} |
|
| 191 |
- |
|
| 192 | 176 |
// localVolume implements the Volume interface from the volume package and |
| 193 | 177 |
// represents the volumes created by Root. |
| 194 | 178 |
type localVolume struct {
|
| 195 | 179 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,29 @@ |
| 0 |
+// +build linux freebsd |
|
| 1 |
+ |
|
| 2 |
+// Package local provides the default implementation for volumes. It |
|
| 3 |
+// is used to mount data volume containers and directories local to |
|
| 4 |
+// the host server. |
|
| 5 |
+package local |
|
| 6 |
+ |
|
| 7 |
+import ( |
|
| 8 |
+ "path/filepath" |
|
| 9 |
+ "strings" |
|
| 10 |
+) |
|
| 11 |
+ |
|
| 12 |
+var oldVfsDir = filepath.Join("vfs", "dir")
|
|
| 13 |
+ |
|
| 14 |
+// scopedPath verifies that the path where the volume is located |
|
| 15 |
+// is under Docker's root and the valid local paths. |
|
| 16 |
+func (r *Root) scopedPath(realPath string) bool {
|
|
| 17 |
+ // Volumes path for Docker version >= 1.7 |
|
| 18 |
+ if strings.HasPrefix(realPath, filepath.Join(r.scope, volumesPathName)) && realPath != filepath.Join(r.scope, volumesPathName) {
|
|
| 19 |
+ return true |
|
| 20 |
+ } |
|
| 21 |
+ |
|
| 22 |
+ // Volumes path for Docker version < 1.7 |
|
| 23 |
+ if strings.HasPrefix(realPath, filepath.Join(r.scope, oldVfsDir)) {
|
|
| 24 |
+ return true |
|
| 25 |
+ } |
|
| 26 |
+ |
|
| 27 |
+ return false |
|
| 28 |
+} |
| 0 | 29 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,18 @@ |
| 0 |
+// Package local provides the default implementation for volumes. It |
|
| 1 |
+// is used to mount data volume containers and directories local to |
|
| 2 |
+// the host server. |
|
| 3 |
+package local |
|
| 4 |
+ |
|
| 5 |
+import ( |
|
| 6 |
+ "path/filepath" |
|
| 7 |
+ "strings" |
|
| 8 |
+) |
|
| 9 |
+ |
|
| 10 |
+// scopedPath verifies that the path where the volume is located |
|
| 11 |
+// is under Docker's root and the valid local paths. |
|
| 12 |
+func (r *Root) scopedPath(realPath string) bool {
|
|
| 13 |
+ if strings.HasPrefix(realPath, filepath.Join(r.scope, volumesPathName)) && realPath != filepath.Join(r.scope, volumesPathName) {
|
|
| 14 |
+ return true |
|
| 15 |
+ } |
|
| 16 |
+ return false |
|
| 17 |
+} |